Hello everybody, i use to work with the animation on jquery but never ajax, so it's my first experience with $.ajax() function of jquery:
i am trying to make my web application only using jquert library, i checked over the web for a good tutorial to make asp.net and jquery work, and i found an walkthrought, in this article they send a int to an WebMethod and it work for me, but in my case i want to send String and/or objects.
i know the issue is int the datatype and/or contentType. here is my code sample.
<script type="text/javascript" src="scripts/jquery-1.4.1.min.js"></script>
<script language="javascript">
$(document).ready(function() {
$("#name").change(function() {
var myname = this.value;
var options = {
type: "POST",
url: "dollarajax.aspx/hello",
data: "{nom:" + myname + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
if (response.d != "") {
alert(response.d);
$("#name").focus();
}
}
};
$.ajax(options);
});
});
</script>
[WebMethod]
public static string hello(String nom)
{
return ("hello my friend: " + nom);
}
so any idea or any document where i can figure the trick to make it work? thanks