ajax - load a page inside page jquery div before posting form -


i have jquery code below posts form checkboxes , updates results according users choices. works fine automatically load page first default results returned when users visits page, if user clicked 1 of results , clicked return previous results.

here code:

$(document).ready(function () {     $(".remember_cb").click(function () {         var action = $("#criteria").attr('action');         var form_data = $('#criteria').serialize();         $.ajax({             type: "post",             url: action,             data: form_data,             beforesend: function () {                 $("#loading").fadein('fast');             },             success: function (data) {                 $('#exercise_list').html(data).fadein('slow');                 $("#loading").fadeout('slow');             }         });     });     return false; });  

any appreciated.

i'm not sure if it's "proper" solution, put code of selector seperate function.

then call function in document.ready section , put selector. way it'll load once page opened , every time user clicks on it.

also i'm not quite sure return false doing, since it's in document ready section.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -