Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. WebMethod called from Javascript mis-behaving

WebMethod called from Javascript mis-behaving

Scheduled Pinned Locked Moved ASP.NET
csharpjavascripthelpannouncementhtml
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    markymark82
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups