dimanche 19 avril 2015

How to send Ajax request using jQuery doubling with click button

using jquery, When user click "send button" then ajax request sent to the server and get double or two more complete the request.


How Can I do this?


http://ift.tt/1DigKCG



$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#revocation" ).dialog({
autoOpen: false,
height: 200,
width: 460,
modal: true,
buttons:{
"Yes": function() {
revocation();
},
"Close" : function() {
$( this ).dialog( "close" );
}
}
});
});

$.ajax({
type: "POST",
url: "/revocation/",
data: "confirm_item=" + $("#exchange_id").val(),
error: function(){
return false;
}
}).done(function( msg ) {
if(msg != "success"){
return false;
}else{

}
});
}

function revocationdialog(the_id){
$.ajax({
type: "POST",
url: "/revocation/",
data: "exchange_id=" + the_id
}).done(function( msg ) {
$("#revocation").html();
$("#revocation").html(msg);
});
$("#revocation").dialog("open");
}

Aucun commentaire:

Enregistrer un commentaire