I'm stuck with this problem for quite some time. Advise needed...
Alright i have this ASPX test-service page(AJAX)
<script type="text/javascript">
$(document).ready(function () {
$('#btnTest').click(function () {
$('#btnTest').hide();
$.ajax({
type: 'POST',
url: "request.asmx/newSync",
data: '',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
complete: function () {
$('#btnTest').show();
},
failure: function (msg) {
$('#result').text(msg);
//alert(msg);
}
});
});
});
</script>
The Web Service
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class test_request : System.Web.Services.WebService
{
public test_request () {
}
[WebMethod(EnableSession = true)]
public SyncAsync newSync()
{
var response = new SyncAsync();
//Test Processing
System.Threading.Thread.Sleep(5000);
try
{
response.Status = "Done";
return response;
}
catch (Exception ex)
{
response.Status = "error";
response.ErrorMessage = ex.Message;
ErrorSignal.FromCurrentContext().Raise(ex);
}
return response;
}
}
Okay my Question is this...Is this Asynchronous?...Meaning when i click the button it sends the request and i shall not wait for any response back from the webservice...?
Can someone explain?
Thank you
completeorfailurecallbacks when the response comes back.error:and notfailure:for any ajax errors.