Reputation: 577
im using jquery in asp.net, if i try to use $.ajax functionality, i got this
<form runat="server" >
... tags it works<form>
tags , jquery works but it doesnt fire $.ajax
eventUpvotes: 0
Views: 115
Reputation: 577
ive solved it. the problem was with asp .net master pages, there are many ways of sending a post-get request from jquery in ajax, but it seems only some of them work in asp .net, ive posted the code for a chat control in c# in http://code.google.com/p/micachat/
an example that works for get request
$.ajax({
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Content-Type", "application/json");
},
type: "GET",
url: "./chatControl/processmessage.aspx?idportal=<%=Request["idportal"] %>",
data: "message=" + $('#message').val() + "&name=" + $('#name').val() + "",
dataType: "text",
success: function(msg){ $("#myDiv").text( "Data Received: " + msg ); }
}); // end of ajax
Upvotes: 0