function createAccount() {
$('#register_user').live('click', function() {
var username = $('#user2_txt').val();
var password = $('#pass2_txt').val();
var email = $('#email_txt').val();
Debug the post using firebug, it should show an error message which might explain a bit further. You can also try to enable break on common runtime exceptions in visual studio, you will find it in the dialog shown if you press ctrl + alt + e
Regards
Interested In New Web UI Technologies? Then Visit My Blog To help others, don't forget to mark the post as answer if it answered your question.
kev101
Member
6 Points
7 Posts
how do you post from jqeury to asp.net page with json post.
Jun 22, 2011 10:08 AM|LINK
here is my jquery function
function createAccount() {
$('#register_user').live('click', function() {
var username = $('#user2_txt').val();
var password = $('#pass2_txt').val();
var email = $('#email_txt').val();
$.ajax
({
type : "POST",
url : "RecieveJsonPost.asmx/RecieveJsonUpadtes",
data : "{'username': '" +username +"','" +password +"','" +email +"'}",
contentType : "application/json",
async : false,
success : function(data)
{
$('#message').text(data.d);
}
});
});
#register is id of html button am listening to it if it is clicked.
then here is my webservice page to recieve the data send by post and display a success message if post is successiful.
[WebMethod]
public string RecieveJsonUpadtes(string username, string password, string email) {
return "Hello World" + username + " : " +password+ " : " +" : " +email ;
}
but the problem is the post is not working i dont know why please assist.
thanks
Lazz. _
Contributor
4419 Points
754 Posts
Re: how do you post from jqeury to asp.net page with json post.
Jun 22, 2011 10:12 AM|LINK
To help others, don't forget to mark the post as answer if it answered your question.
kev101
Member
6 Points
7 Posts
Re: how do you post from jqeury to asp.net page with json post.
Jun 22, 2011 02:12 PM|LINK
hey Lazz thanks for replying but still it is not working
Lazz. _
Contributor
4419 Points
754 Posts
Re: how do you post from jqeury to asp.net page with json post.
Jun 22, 2011 02:21 PM|LINK
There was a few more errors, change your data line to:
data: '{"username": "' + username + '", "password": "' + password + '", "email": "' + email + '"}',
And make sure your webservice has the [ScriptService] attribute set.
To help others, don't forget to mark the post as answer if it answered your question.
kev101
Member
6 Points
7 Posts
Re: how do you post from jqeury to asp.net page with json post.
Jun 23, 2011 11:13 AM|LINK
i have corrected the code and marked my webservices with [ScriptService] attribute but it still not working yet.
Lazz. _
Contributor
4419 Points
754 Posts
Re: how do you post from jqeury to asp.net page with json post.
Jun 23, 2011 05:04 PM|LINK
Debug the post using firebug, it should show an error message which might explain a bit further. You can also try to enable break on common runtime exceptions in visual studio, you will find it in the dialog shown if you press ctrl + alt + e
Regards
To help others, don't forget to mark the post as answer if it answered your question.