json - MVC4 Jquery / UI / Ajax Release Build breaks my form submissions? -
very strange issue.
i have mvc4 web application uses pop-up editing (through jqueryui , partial views) , works fine when application built in debug mode, or if it's built in release mode , run on iis express.
the httppost action either returns html partialview containing errors (which repopulates ui dialog box) or json response return json(new { success = true });
if deploy debug build iis, works fine.
however, if deploy release build iis stops working , client browsers (all of them) start treating json responses file downloads......?!
i've fiddled requests , different..... ones work send headers:
accept: */* content-type: application/x-www-form-urlencoded; charset=utf-8 x-requested-with: xmlhttprequest
...and ones 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 different based on build config....?! help?
well found out answer was......talk perfect storm....
i using jquery 1.9.1. apparently recent versions of jquery cause "bundling" break.....
in debug mode, , in release mode on iis express bundling was't doing anything. however, when published release-mode iis sprung life.....and promptly broke javascript.
....which preventing jquery.on handler overriding form submit button.....
....which causing form submitted via html , not ajax......
....which causing json response "downloaded file" browser......
....which makes me feel bit dumb asking question in first place clues there.....
the solution, of course, fix jquery*.min.js files don't break bundling (as described in attached question/answer). ho hum.
Comments
Post a Comment