Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Please check error comes at alert(XMLHttpRequest.response);
alert(XMLHttpRequest);


<script type="text/javascript" language="javascript">
$(document).ready(function () {
SearchText();
});
function SearchText() {

$(".autosuggest").autocomplete
({
source: function (request, response) {
$.ajax
({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "../Default.aspx/Mydata",
data: "{'username':'" + request.term + "'}",
dataType: "json",
success: function (data) {

response(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(request.term);
alert(XMLHttpRequest.response);
alert(XMLHttpRequest);
alert(textStatus);
}
});
}
});
}
</script>
Posted
Comments
F-ES Sitecore 7-May-15 5:25am    
You're using jQuery and all of that code is client-based, what version of .net you use is irrelevant. If you're not getting back what you expect then use a tool like Fiddler or the browser's dev tools to examine the http request and response to see exactly what is being sent back.
HimenDev 7-May-15 8:23am    
I know what you are saying is totally correct.. but the thing is my server side web method is not being called by above mentioned code...please help me to resolve it...
F-ES Sitecore 7-May-15 8:25am    
I can't access your machine so have no idea why it isn't working. As I suggested already, use fiddler. That will show you exactly what is being passed on the wire and will show you any error messages and error statuses that are being swallowed.
HimenDev 7-May-15 8:36am    
I am using my .Aspx page and my webmethod is written in the same page..i dont know what fiddler is ...sorry to disappoint you...
F-ES Sitecore 7-May-15 8:41am    
google "download fiddler"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900