Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 25, 2010 03:18 AM by pharcyde357
Aug 22, 2010 09:21 PM|LINK
Can someone point me in the right direction on how to submit data from a jQuery form to a ASMX webservice? I have gotten everything on the form ready to be submitted to the database and now I am stuck on how to send it over using $.ajax(). Everything I have
read tells me how to get data from a webservice and display it with jQuery, but not the other direction nor how to access the json data within the within the webservice service(similar to a Request.Form approach with ASP.NET forms).
In other words:
1. What do I need to do to my webservice to make sure it can receive data from the jQuery form.
2. What do I need to do in jQuery to receive an acknowledgement the save on the server side was successful.
I can explain more if need be, but if there is a comprehensive tutorial on not only reading, but also WRITING data with jQuery, JSON, etc. I would love to get pointed in that direction.
jquery webservice asmx ajax json
Aug 23, 2010 02:36 PM|LINK
Here is a great article on JQuery and ASMX web services:
When using ASMX web services you will pass it the variables you need and it will return whatever you want it to (a datatable, a string, an integer, etc). For your "confirmation" of a completed service, I would simply have it return integers. If it returns
0, it failed and if it returns 1 it succeeded. Something like that.
Aug 23, 2010 03:01 PM|LINK
Please take a look at the following links:
http://www.weask.us/entry/calling-asmx-jquery - implement the logic to insert data into database in the GetSurvey() method of the given example.
http://stephenwalther.com/blog/archive/2010/03/26/using-jquery-to-insert-a-new-database-record.aspx - to use JQuery with Handlers
or WCF Services.
Hope this helps.
Aug 25, 2010 03:18 AM|LINK
Thanks folks - I am reading through these now. I am also really interested in a post here which looks promising.
I will let you all know how it comes out....as I might have some follow ups that are pertinent to the thread.