Problem in calling Web service through JQuery in DropThings Framwork

Dec 27, 2010 at 3:52 AM


plz anybody tell me, how to write JQuery to call web service in dropthinf framework.
i have gridview control in my widget and i want to autoupdate its content without page refresh.
thats why i have written one web service which will return updated data in json format to JQuery.
by using this updated jsonn object i will update my gridview contents.

i am new to JQuery. if anyone had done this before then plz just give some solution to me.

Thanx in advance!!!!

Jan 28, 2011 at 4:15 PM

hi bhusan, i just got something working out of jquery calling a page method. if that's what you are refering to, but my webservice to autoupdate my gridview/detailview failed.

 

here is a  sample

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Services" %>
<html >
<head id="Head1" runat="server">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jQuery/1.4.2/jQuery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#sayHelloButton").click(function(event){
$.ajax({
type: "POST",
url: "dummyWebsevice.asmx/HelloToYou",
data: "{'name': '" + $('#name').val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h1> Calling ASP.NET AJAX Web Services with jQuery </h1>
Enter your name:
<input id="name" />
<br />
<input id="sayHelloButton" value="Say Hello"
type="button" />
</form>
</body>
</html>