WebMethod called from Javascript mis-behaving
-
Hey guys, Hoping someone might be able to shed some light on a problem I am currently having. I have a WebMethod being called by some javascript code, everything is working as it should, the WebMethod is a static string. I am writing the output (which contains a small amount of html) to a hyperlink on my page (I'm adding a product to a basket and updating the link to the basket with item total etc.). On my local dev machine, and on a staging version of the website (a copy of live) this all works nicely, the hyperlink shows what it is supposed to. But when put live, the WebMethod is called fine, and the output comes out in JSON format. This in itself I didn't think was a problem as I can just use jquery to parse the JSON, but it fails in firefox as being invalid JSON. What's even weirder is that when I created a 2nd test version of the page (a carbon copy, just with the name changed), that behaves perfectly on live, without the need for JSON parrsing. This isn't a problem in all browsers, IE, Chrome (release) and the latest Safari all pop the raw JSON in as the hyperlink text, Firefox (4) seems to parse it and shows the correct HTML. Can anyone think why it would behave differently between 2 identical pages, where only the name is slightly different, and what the best way to parse the JSON is when it is returned from the WebMethod. Does it have to come back as JSON, I know xml is an option but really I could do with just a string.. I tried clearing all of my temporary files, so I know it's not a caching issue. Live server (and the staging one too): Win Server 2003 IIS6 The website is .Net 3.5, C# Thanks in advance!