I’m stuck with this stupid issue, trying to make Jason call to load data from database.
it gives me the stupid error of” Failed to load resource: the server responded with a status of 500 (Internal Server Error) “http://localhost:4695/SAW.WEB.ONLINE/AutoComplete.asmx/GetMapInfoDiv?{‘conType’:’2′,’conID’:’5′}”
The weservice, and the function are working just fine. I tested them, the url for the web service is correct, I used for ajax autocomplete and it works fine, I even used the ajax autocomplete on the same page.
here is my web service method:
[WebMethod]
public string GetMapInfoDiv(string conType, string conID)
{
DBLink objResult = new DBLink();
objResult = GenericContent.GetMapInfoDiv((MapMarkerType)
Convert.ToInt32(conType), Convert.ToInt32(conID));
return Convert.ToString(objResult.dataSet.Tables[0].Rows[0][0]);
}
and here is my javascript call.
function LoadInfoDivByType(ContentType, ContentID) {
var html;
$.ajax(
{
Type: "POST",
contentType: "application/json; charset=utf-8",
url: "../AutoComplete.asmx/GetMapInfoDiv",
data: JSON.stringify({ conType: ContentType, conID: ContentID }), //{conType:"'" +ContentType+ "'",conID:"'" + ContentID + "'"}, //
//data: "{'conType':'" + '2' + "','conID':'3'}",
dataType: "json",
success: function (msg) {
html = msg.d;
alert(html);
}
});
}
Thanks for your help
I think you forget to write like this
ScriptMethodalso in jquery part remove
JSON.stringifyfunctionCheck : http://www.aspsnippets.com/Articles/Make-AJAX-Call-to-ASP.Net-Server-Side-Web-service-method-using-jQuery.aspx