How To Wait Until All Ajax Requests Are Finished In JQuery
Posted by blogmeister on
April 4, 2013
The solution is simple if you know which function to call. I had read so many suggestions, some long, some a hassle when in fact, the quickest and shortest solution to execute code after all Ajax requests are finished in JQuery is this:
|
1 2 3 |
$(document).ajaxStop(function () { // do something }); |
Easy, right?
Share the post "How To Wait Until All Ajax Requests Are Finished In JQuery"
tags: ajax, finish, jquery
No Comments
JQuery Form Plugin Easily Binds To HTML Forms
Posted by blogmeister on
March 16, 2013
So what is with a little Javascript library, right? Even though it is not hard work to go around to using forms in Javascript, using JQuery Form plugin enables me to gain access to my form after simple Ajax calls.
The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted.
Their site says it is extremely useful for sites hosted in low cost web hosting providers with limited features and functionality. But even so, JQuery‘s simplistic approach and flexibility created this awesome plugin that enabled me not to have to code on doing Ajax calls the traditional way.
Say, you have this HTML form.
|
1 2 3 4 5 |
<form id="myForm" action="comment.php" method="post"> Name: <input type="text" name="name" /> Comment: <textarea name="comment"></textarea> <input type="submit" value="Submit Comment" /> </form> |
Simply initialize your form when the DOM is ready. Once the form is submitted, you can get what is returned from the server. Easy, right?!
|
1 2 3 4 5 |
$(document).ready(function() { $('#myForm').ajaxForm(function(msg) { alert("Message from server: " + msg); }); }); |
Share the post "JQuery Form Plugin Easily Binds To HTML Forms"
tags: ajax, html, jquery, jquery form, plugin
No Comments
How To Add Delete Functionality In JEasyUI DataGrid
Posted by blogmeister on
January 30, 2013
While JEasyUI has an extended DataGrid component called eDataGrid, I opted to still use DataGrid rather than load up another script library.
Here is the function to delete a row in a JEasyUI DataGrid table complete with a notification popup when the delete HTTP request is in progress and closes itself when it is done.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function deleteRow(index) { if (confirm('Are you sure you want to delete this entry?')) { $('#tt').datagrid('loading'); $.ajax({ type: 'POST', url: 'delete.php', data: '', success: function (msg) { $('#tt').datagrid('loaded'); $('#tt').datagrid('deleteRow', index); }, error: function (msg) { $('#tt').datagrid('loaded'); } }); } } |
Share the post "How To Add Delete Functionality In JEasyUI DataGrid"










