Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jquery - how can i stop a ajax request in ajaxSend? -


$('#speichern').live('click' , function () {      var data_save = $('#form_rechn').serialize()+ '&' + 'action=save' + '&' + 'total=' + number($('#grandtotal').text().replace(/eur/g, ""));   $.ajax({      type    : "post",     cache   : false,     url     : 'invoice_new_action.php',     data    : data_save,      ajaxsend : $.post("invoice_new_action.php",{"action":"before","rn":   $('#rn').val()},function(huhn){                 var totest = number(huhn)                 if ( totest == "") {                     } else {                 $('#rn').val(totest);                  $.fancybox('nr. existiert. ');                 return false; // why don't stop here?                 };}),       error:function (xhr, ajaxoptions, thrownerror){                 alert(xhr.status);                 alert(thrownerror);      },     success : function(data) {          $.fancybox(data);              }     }); 

can way? why ajax not stopped via return false?

why doesn't stop? because function defining callback function $.post, called when response post. because $.post asynchronous default, can't post , wait response find out if should keep going original ajax call.

you either use synchronous ajax post (eww! bad!) or explain end result trying accomplish. community's help, perhaps can rethink implementation doesn't require 1 ajax post decide if need post another. in general, think want this:

$('#speichern').live('click' , function () {   // post test if should keep going   $.post('...',function(huhn){     // ...     if (totest){       // oh, ok, can call real ajax.       $.post(...,data_save,function(data){         $.fancybox(data);       });     }   } }); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -