calling web service through java script in mvc3
I made one web service, and try to call it with Java script, I found error of unknown method "ServiceImage". This is the following code snap of JScipt
<script language="javascript" type="text/javascript">
ServiceImage.GetImageContract开发者_如何学编程(Txt, imageName, function (imgbol) {if (imgbol == true) ......
</script>
` I am using the following code also
<asp:ScriptManager ID="ScriptManager1" runat="server" >
With ASP.NET MVC its probably easiest and arguably preferred to call a web service with jQuery like this:
(no paramerers passed or REST based web service)
$.get('ajax/test.html', function(data) {
$('.result').html(data);
alert('Load was performed.');
});
(with parameters)
$.post("test.php", { name: "John", time: "2pm" }, function(data) {
$('.result').html(data);
alert("Data Loaded: " + data);
});
Here's more information on jQuery ajax API jQuery Ajax API
精彩评论