jquery response back -
i sending ajax call page. want value of variable, lets call x, page on success. how can that. here ajax code
$.ajax({ type: 'post', url: 'myotherpage.php', data: 'loginname=' + loginname , success: function(success) { if(success == 1) { //get variable value here } else { //do nothing } } });
your other page should return json, contains status variable (1 success, 0 fail), , variable or whatever data need. here's example file have here. won't run of course, should give idea.
req = $.ajax({ type: 'post', data: this.data.filter, url: this.data.dataurl+"listids", datatype: 'json', timeout: 5000, cache: false, error: function(){ usernotify({class:'notify_alert', content:'your request can\'t completed @ time.<br />an external error has been encountered. please wait moment , try again.'}); }, success: function(o){ if ( 0==o.status ) { if ( undefined == o.user_msg ) { o.user_msg = '';} usernotify({class:'notify_alert', content:'your request can\'t completed @ time.<br />'+o.user_msg}); } else { if ( 0 < o.data.ids.length ) { tli.data.update.ids = o.data.ids; } } } });
Comments
Post a Comment