thanks, that's it.
On 13 Jan., 23:21, Danny <[EMAIL PROTECTED]> wrote: > I'm not an AJAX guru, but it looks like the pageNumber variable is > local to each of your click functions and won't be seen by the > showResponse function. > Make it global (actually, local to the document.ready function): > > $(document).ready(function(){ > var pageNumber; // local variable in this document.ready function > ...other stuff.. > function showResponse(responseText, statusText) { > $("body").addClass("curAuto"); > $('div#adv_content').load('inc/de.application.adv.inc.php? > page='+pageNumber); // showResponse doesn't have its own pageNumber > variable, so it uses the enclosing function's one. This is called a > closure. > } > > $('#step1').click(function(){ > pageNumber = '0'; // note: no 'var' ! So no local pageNumber > variable, so it uses the enclosing function's one. The same one that > showResponse will use later! A little bit of Javascript magic. > $('#myform').ajaxSubmit(options); > return false; > }); > > On Jan 13, 2:47 am, antiheld2000 <[EMAIL PROTECTED]> wrote: > > > hi, > > > i'm developing a little site, where the user has the possibility to > > fill in several forms. i want that the user can navigate through those > > forms via normal html links. on click the form should be submitted and > > on success the content in div #xy be updated in relation to the link. > > i tried it like this, but this is not working. has anybody a > > workaroung or else? > > > thank you > > anti > > > my try: > > > $(document).ready(function(){ > > var options = { > > beforeSubmit: showRequest, > > success: showResponse, > > url: 'inc/application.adv.func.php' > > }; > > > function showRequest(formData, jqForm, options) { > > $("body").addClass("curWait"); > > var queryString = $.param(formData); > > return true; > > > } > > > function showResponse(responseText, statusText) { > > $("body").addClass("curAuto"); > > jQuery('div#adv_content').load('inc/de.application.adv.inc.php? > > page='+pageNumber); > > > } > > > $('#step1').click(function(){ > > var pageNumber = '0'; > > $('#myform').ajaxSubmit(options); > > return false; > > }); > > > // etc. etc. > > > $('#step5').click(function(){ > > var pageNumber = '4'; > > $('#myform').ajaxSubmit(options); > > return false; > > }); > > > })