3

I've search high and low for an answer to this but unfortunately I'm stuck. The problem is only occuring in Firefox (tested IE, Chrome and Safari also - works fine, no errors of any sort). I'll detail the sequence of events to save posting all my code.

  1. ASP.NET MVC 3 application, basic form loads into a jQuery UI dialog
  2. Custom jQuery to hijax the form submit (serialize the form and then $.post to the server - no compiler errors when debugging and post shows up in Firebug without errors)
  3. Http GET (automatically happens) getting the response object from the server (+ success text and XHR), response is plain HTML in this case (again, shows up in Firebug with no errors)
  4. Custom jQuery to change the HTML of the UI dialog from it's current HTML to the response Html - this is where it fails.

I've used javascript alerts to debug the sequence of events and as soon as the post (and get) is complete, everything just... sort of stops.

As I say, only in firefox! Very odd, just wondering if there's any known bugs with ajax and firefox or anybody has heard of a similar situation?

I must also add, that on other parts of my site, this works perfectly in all browsers! The only difference between this form and the other forms that do successfully complete the function is that the response from this form is the same "page" again but updated rather than a new "page". (I use "page" as I got all this working with Javascript turned off first and for graceful degredation)

HELP! Or laugh, either is fine.

UPDATE

I have tried sending a view with a blank model back as the action result - works in every browser except firefox - firefox retains the values from the previous post! And then I got to thinking - that's a trait of firefox isn't it? And maybe that's why the original "re-direct" html response doesn't work?? I think it's time to give up and let people know they can't use Firefox for that particular function!

LiverpoolsNumber9
  • 2,384
  • 3
  • 22
  • 34
  • What version of Firefox? ...and hahaha jk ;) – TNC Feb 17 '11 at 09:41
  • :) 3.6.13 at the moment... – LiverpoolsNumber9 Feb 17 '11 at 09:43
  • What is the response code from the server for step 4. Normally it should be 200. If other that might be the problem. – Gutzofter Feb 17 '11 at 18:21
  • 200 - I can see the post and the get being performed in Firebug and the post is fine (it updates the db) and it's response Html is exactly what it should be. But then (as per every other place on the site), the js telling the response html to be placed in the UI dialog doesn't fire! – LiverpoolsNumber9 Feb 18 '11 at 11:32
  • it might be that the get `dataType` object returned is different than expected. Try swapping it out with a pure `$.ajax` request so that you can add a error handler. see if an error is called from jQuery AJAX. – Gutzofter Feb 18 '11 at 18:56
  • @Gutzofter - thanks for the suggestion - I am fully handling the error already and there are no errors! – LiverpoolsNumber9 Feb 21 '11 at 13:59

2 Answers2

2

Ok so I'm answering my own question.

The only way I found to get round it is to use $.ajax instead of $.post and to use the option async : false

Hope this helps somebody.

Rob

LiverpoolsNumber9
  • 2,384
  • 3
  • 22
  • 34
0

Have you tried adding the attribute [OutputCache(Location = System.Web.UI.OutputCacheLocation.None)] to your Action for your GET? It sounds to me like a caching issue.

jessicah
  • 945
  • 10
  • 15
  • Hi, thanks for the response. Tried this but to no avail. Also tried a re-direct to another ActionResult (and then back to where I want) and it just won't have it! Next step, uninstall Firefox, re-install and see what happens!! (Desperate). Thanks for the suggestion though. – LiverpoolsNumber9 Feb 18 '11 at 11:30