I have write the Web method to return int 0 or 1 for thati am writing javascript
function TempBlockSeat(seat)
{
var bool=false;
var routeid = getParameterByName('routeid');
var tripdate = getParameterByName('tripdate');
$.ajax({
type: "POST",
url: "ticket_booking_user.aspx/TempBlockSeat",
data: "{'args':'" + seat + "$" + routeid + "," + tripdate + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (Data) {
bit = Data.d;
if (bit == 0) {
global = 1;
bool = false;
alert("Suceesss");
}
else {
global = 0;
bool = true;
alert("Suceess1");
}
},
Error: function (r) {
bit = false;
}
});
return bool;
}
but the problem is that fist he return value and then go to success fuction i have set web method result in success function but
He return value and then go to Sucess block Help me