returning a response in json after a post

Hi, i have a webservice which i call using jquery. When i post data the request qnd response looks like this

 

Réponse
ServerASP.NET Development Server/8.0.0.0
DateTue, 09 Sep 2008 21:11:42 GMT
X-AspNet-Version2.0.50727
Cache-Controlprivate, max-age=0
Content-Typetext/xml; charset=utf-8
Content-Length89
ConnectionClose
Requête
Hostlocalhost:4555
User-AgentMozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Acceptapplication/xml, text/xml, */*
Accept-Languagefr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encodinggzip,deflate
Accept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive300
Connectionkeep-alive
Content-Typeapplication/x-www-form-urlencoded; charset=UTF-8
X-Requested-WithXMLHttpRequest
Refererhttp://localhost:4555/Website/gro/Main.aspx
Content-Length2182
CookieASP.NET_SessionId=rzjndj55dp2z3zvxyygan3nw

 

Is there a way to return json instead of xml after a post? I've tried playing with the response in the code before returning from the webservice call but nothing seem to change.

Thanks

Mateo

0
mateo666
9/9/2008 9:15:50 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

2 Replies
437 Views

Similar Articles

[PageSpeed] 17

mateo,

What does your JQuery call look like?

James


James Ashley, Magenic Technologies
(james.ashley.magenic@gmail.com)
0
vgiambattista
9/10/2008 1:14:45 AM

 Hi James,

 i use the jquery form plugin like this

options = {
        target:'#message',
        beforeSubmit: validateSaveDemande,
        url:"MyWebService.asmx/SaveDemande",
        type:'post',
        dataType:'json'
}
$("#aspnetForm").submit(function()
    {       
        $(this).ajaxSubmit(options);
        return false;
    }); 

 

thanks for your help

mateo

0
mateo666
9/10/2008 1:22:22 PM
Reply:

Similar Artilces:

Webservice returns a valid SOAP response but proxy returns null
Hi, We've been having real trouble consuming a webservice on an Apache server in C#, I've scoured the various forum posts discussing a dodgy namespace, casing and updating the OperationContractAttribute attribute but none of them seem to fit (unless I'm missing something). From what I can see, it all looks fine so I was wondering if anyone else could shed any light on what we're missing. The platform is C# .Net 3.5, I'm working in Visual Studio 2008 SP1 and have been inspecting the response using Fiddler 2. I've uploaded the WSDL (with the end point r...

Does a ScriptService enabled WebService return JSON? If so how do you return database information?
I have read that when you use the [ScriptService] attribute in a WebService the webservice returns JSON.  Is that accurate?  If so what do you do when you want to return database queries from your web service?  I have mostly seen simple examples that add two numbers and return an int or simple hello world string. Just wondering how to proceed. Thank you. Hi,the default's indeed JSON but you could alter it by using the ScriptMethod attribute and in that set the ResponseFormat = Xml.Grz, Kris. Read my blog. Handy Firefox plugins for web developers.Workaround for non work...

WebService with ResponseFormat.Json won't return JSON, only XML
I can't get my ASP.NET AJAX webservice to return JSON, it always returns XML.  The docs say that it should return JSON automatically -- how do I enable this?  Here is my WebService.cs source:1 using System; 2 using System.Web; 3 using System.Collections; 4 using System.Web.Services; 5 using System.Web.Services.Protocols; 6 using Microsoft.Web.Script.Services; 7 8 /// <summary> 9 /// Summary description for WebService 10 /// </summary> 11 12 [ScriptService] 13 public class WebService : System.Web.Services.WebService { 14...

xml .net webservice response to string.
I'm calling a .net xml webservice using a webreference in vb.net.  The response xml of the webservice is a complextype of 3 items. How can I convert the complextype response to a string to store in my DB? It probably would be best to store the information in 3 separate columns in the database.If that really doesn't matter for your case (it's nothing you'll EVER want to query or have a small table record count), you could serialize it into Xml and store that.  Make sure your class has a (Serializable) Attribute. http://www.dotnetspider.com/code/C-3...

[svn:parrot-pdd] r22465
Author: tewk Date: Wed Oct 24 17:11:20 2007 New Revision: 22465 Modified: trunk/docs/pdds/pdd23_exceptions.pod Changes in other areas also in this revision: Added: trunk/t/op/exceptions.t Modified: trunk/DEPRECATED.pod trunk/compilers/json/JSON/pge2pir.tg trunk/compilers/json/postalcodes.pir trunk/compilers/past-pm/POST/Grammar.tg trunk/compilers/pct/src/HLLCompiler.pir trunk/compilers/pct/src/POST/Grammar.tg trunk/compilers/pge/PGE/Exp.pir trunk/compilers/pirc/src/pirutil.c trunk/compilers/tge/TGE/Compiler.pir trunk/docs/compiler_faq.p...

powerbuilder wsdl return value .Net webservice
The function GetInvoiceIDsByCustomer() returns an any variable (array). I had expected we could use allways a string as we did with easysoap. This is not excepted. In some cases we have to use a longlong, in other cases a string. I had expected powerbuilder would automatically convert the longlong to a string. Why differs this between EasySoap and .Net. Thanks Eric Solved this one by using an any array. Thanks Eric ontsnapt wrote: > The function GetInvoiceIDsByCustomer() returns an any variable (array). > > I had expected we could use allways a string a...

access response returned after POSTing using WebBrower
There may be a much easier way to do what I'm trying to do: if so, please point me in the right direction. I'm trying to automate interaction with a web site. In particular, I send some data to the site using POST and it returns a PDF document. All of this is working fine, except that the PDF document is being displayed in the WebBrowser (good!), but I can't figure out how to grab a copy of it on its way from the server to the screen (bad!). Are there any simple tutorials about how to do this? Or should I be using something like Indy? My problem with most of the example...

Restful web services in .net that return JSON
I have noticed that there are many sites out there that provide restful apis (Yahoo, Google, etc.). I would like to create my own restful api that can be called from javascript like the big guys do. I have worked with .net and MSSQL before but I can't quite seem to find a really good example that shows me how to do this. I can build the database. I can write the business logic in C#. What I don't know how to do is to expose that functionality as a web service that returns JSON. Can anyone point me to a good example?? My other option is to use rails, but I'm more familiar with the...

Authorize.Net HTTP POST Returns Error!
Any help on this would be much appreciated. I know there are controls out there to purchase that do exactly this, but that somewhat defeats the purpose of discovery and self-improvement. I am posting from an SSL connection, and I get the following error from Authorize.Net : (92)The Gateway no longer supports the requested method of integration. Here is my code : sGatewayURL = "https://secure.authorize.net/gateway/transact.dll" sQueryString = "x_version=3.1&x_login=login&x_password=pass&x_delim_data=TRUE&x_amount=10.52&x_card_num=4007...

Calling Java webservice through .net returns null
Hi, I'm calling a java webservice from my .net application. The web service method always returns null when called from the application. The web service works fine if called from java application. Any references will help. Thanks in advance. Kshitij RajhansInfosys Technologies Ltd,Pune. kshitij: I'm calling a java webservice from my .net application. The web service method always returns null when called from the application. Hi This problem may occur during communicate with different platform, Please check if there is any special parameter or custom object in your webservice,...

How to get a .net web service to return JSON not XML
I have a web service written in .net 1.1 using vb.net that I need to return JSON. How to I get it to return only the values contained in the xml below - without the XML?  Thanks in advance. <?xml version="1.0" encoding="utf-8" ?> <string xmlns="http://tempuri.org/WebService/ws">{"result":[{"track":{"vid":"6303","kid":"30","dt":"2/13/2006 6:32:46 AM"}}]}</string>     check this page and you must be very happy! http://www.kawa.net/works/js/jkl/parsexml-e.html Let me ask you a question: how to append/combine two JSON objects (assuming their str...

[VB.NET][WebService]Content-type and Post HTTP
hi, i developped a webservice which one our client use with POST HTTP but we ask to our client to set the content-type on "application/x-www-form-urlencoded" to match with our webservice. now the problem is that the message we receive from them are missing somme character like "é", "à", etc... our client told us that is because of the "application/x-www-form-urlencoded" and if we set the content-type of the webservice on "text/xml" maybe it will be the solution but we don't know how to change this on our webservice or maybe it's a problem of "encoding" because i read some artic...

WebService returns XML even when ResponseFormat set to JSON
Hello, I have created a simple web service and method that returns 'Hello World', but I want the method to return the string as json. I have set ResponseFormat = ResponseFormat.Json and on the client I have set the request content type to "application/json; charset=utf-8". Still, the response is always xml. Any thoughts about what i need to change to get a json response. I am using Prototype.js to handle all the ajax stuff. I have verified that the request object does have the correct content type and that the response object does have null for responseJSON and null for he...

Example of .NET webservice returning data to Java, cfmx...
What is the best method for .net to return multiple rows when used in a web services.  If I use a dataset and consume with .net, everything is OK.  But is I trying consuming the webservice with Cold Fusion I get errror on the CFMX side.  What should .NET return that is readable to all programs?thanksDaniel read this http://forums.asp.net/ShowPost.aspx?PageIndex=1&PostID=1091439#1091439 Fadil Alnassar www.fadilalnassar.com | FREE Nodil Tab Controlhttp://www.mefranchising.com Fadil - Thanks.  I'm taking the microsoft Web Service class next week (3days).  ...

Web resources about - returning a response in json after a post - asp.net.networking-webservices

Returning - Wikipedia, the free encyclopedia
In retail , returning is the process of a customer taking previously purchased merchandise back to the retailer, and in turn, receiving a cash ...

Mark Zuckerberg Returning To TechCrunch Disrupt
Facebook Co-Founder and CEO Mark Zuckerberg took the stage at last year’s TechCrunch Disrupt conference in San Francisco, where he discussed ...

How-to: Improve the Experience for Returning Users
... – your inbox, your favorite news sources, or your friends’ activity. If you’ve integrated Facebook Login on your website, you can give returning ...

Search Twitter - emilia-clarke-not-returning
Sign in Sign up Search Refresh K. @ kikeurbina 1h Muy malas noticias: 'GAME OF THRONES' STAR EMILIA CLARKE (DAENERYS) NOT RETURNING FOR SEASON ...

Is the Returning CEO a Trend?
... well be wondering if it is a new trend for boards to reach back into their alumni ranks to bring back a CEO when a company is in Is the Returning ...

Returning fire - Flickr - Photo Sharing!
A U.S. Army soldier with the 101st Airborne Division returns fire with a M249 light machine gun during combat operations in the valley of Barawala ...

Marines Celebrate Returning Home With a Huge Pillow Fight Aboard the Airplane - YouTube
Visit http://WelcomeHomeBlog.com for more surprise military homecomings! In this clip, a group of marines celebrate their safe return home from ...

WWE’s Daniel Bryan on WWE 2K16, facing Brock Lesnar at WrestleMania, returning to the ring and life on ...
The four-time WWE world champion discusses whether it is right for Stone Cold Steve Austin to be the cover star of WWE 2K16, as well as who he ...

Damn Fine News of the Day: Kyle MacLachlan is Returning to ‘Twin Peaks’
In case you missed it, David Lynch announced on Twitter Monday that Kyle MacLachlan will reprise his role as Special Agent Dale Cooper in the ...

Injury not enough to keep official caught in crossfire from returning to action
The NRL match official caught in the crossfire of angry Bulldogs fans says he has no intention of stepping down from his role on the sidelines. ...

Resources last updated: 11/24/2015 1:07:04 AM