MVC4 Jquery / UI / Ajax Release Build breaks my form submissions?

Very strange issue.

I have an MVC4 web application which uses pop-up editing (through JQueryUI and partial views) and it works just fine when the application is built in debug mode, or if it's built in release mode and run on IIS Express.

The HttpPost action either returns a HTML partialview containing errors (which repopulates the UI Dialog box) or a JSON response return Json(new { success = true });

If I deploy a DEBUG build to IIS, it also works fine.

However, if I deploy a RELEASE build to IIS it stops working and the client browsers (all of them) start treating my json responses as file downloads......?!

I've Fiddled the requests and they are different..... The ones that work send headers:

Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest

...and the ones that fail.....

Accept: text/html, application/xhtml+xml, */*
Content-Type: application/x-www-form-urlencoded

...and no X-Requested-With header.

TBH I've got no idea why REQUEST headers would be different simply based on build config....?! Help?


Well I found out what the answer was......Talk about a perfect storm....

I was using JQuery 1.9.1. Apparently the recent versions of JQuery cause "bundling" to break.....

In debug mode, and even in release mode on IIS Express bundling was't doing anything. However, when I published release-mode to IIS it suddenly sprung into life.....and promptly broke my javascript.

....Which was preventing my JQuery.on handler from overriding the form submit button.....

....Which was causing the form to be submitted via HTML and not AJAX......

....Which was causing the JSON response to be "downloaded as a file" by the browser......

....Which makes me feel a bit dumb for asking the question in the first place as all the clues were there.....

The solution, of course, is to fix the jquery*.min.js files so that they don't break bundling (as described in the attached question/answer). Ho hum.

Need Your Help

link error, how it happens?

c++ struct declaration

i have two files, utility.h and utility.cpp. i declare a struct BoundingSphere in the .h file

Sending an image from a C# client to a C server

c# c sockets

If I send plain text there is no problem. Everything is ok.