Im trying to get a response from a function in a webservice but i dont think i am creating the service correctly…
This is the code for web service…
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld(ByVal ManufID As String) As String
Return "{\'error\': \'Not found\'}"
End Function
End Class
this is the jquery…
$.ajax({
type: "POST",
url: "WebService.asmx/HelloWorld",
data: '{' +
'ManufID:"' + item + '"' +
'}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var data = json_parse(msg.d);
if (!data.error) {
$.each(data, function (d) {
alert(data[d].model);
$("<option>").attr("value", data[d].id).text(data[d].model).appendTo($('.Finish1'));
});
}
else {
alert("Cannot get memeber's notes data\n" + data.error);
}
},
error: function (msg) {
alert('Get Details Failure: ' + msg);
}
});
I know it wont work completely yet, im just trying to get the communication right for now…?thanks
Check this article out. http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/
If you only plan to call this from within your application, you should create a page method instead of a web service.
Throw this under your page_load() function of Default.aspx
Then put this in the header of Default.aspx