0
Vasanti
sorry to say i dont want to use async:false. bcz its some perfomace problem
0
Try to use input type button not input type Submit.
0
this works for me
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$("#<%=btnOK.ClientID%>").click(function () {
var test;
$.ajax({
type: "POST",
data: {},
async: false,
url: "WebService.asmx/HelloWorld",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
error: function (xhr, errorType, exception) {
try {
alert(xhr.StackTrace);
var responseText;
responseText = $.parseJSON(xhr.responseText);
var v = JSON.stringify(xhr.responseText);
$("#msg").html(v);
alert('error :' + v);
var d = xhr.stackTrace;
test = false;
}
catch (e) {
}
},
success: function (response) {
alert('sucess :' + response.d);
if (response.d == "Hello World") {
test = true;
$('#<%=btnOK.ClientID%>').submit();
alert('inside success,value :' + test);
test= true;
}
else {
test= false;
}
//alert("t- " + test); // here we can call server side code
}
});
//alert('outside, value:' + test);
return test;
});
});
</script>
0
button id.submit() not work if it is sucess...its urent plz some buddy help me
0
var test;
$.ajax({
type: "POST",
url: "WebService1.asmx/HelloWorld",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
error: function (xhr,errorType,exception)
{
try
{
alert(xhr.StackTrace);
var responseText;
responseText = $.parseJSON(xhr.responseText);
var v = JSON.stringify(xhr.responseText);
$("#msg").html(v);
alert('error :' + v);
var d = xhr.stackTrace;
}
catch(e)
{
}
return false;
},
success:function(response)
{
alert('sucess :' + response.d);
if(response.d=="Hello World")
{
test = true;
$('#<%=btnOK.ClientID%>').submit();
alert('inside success,value :' + test);
}
else {
test = false;
//return test;
}
// alert(test);// here we can call server side code
}
});
alert('outside, value:' + test);
return false;
});
0
Vasanti
i already applied what you are suggesting about.
0
write the jquery.ajax code on client side button click and then return true false accordingly