DCSIMG
ASP.NET MVC 3.0 jquery unobtrusive ajax Failed on IE 8 - Rotem Bloom's Blog

Rotem Bloom's Blog

Share knowledge on .NET and web development

News

About Me

Glad to help and share knowledge on .NET and also huge fan of Dream Theater.

Contact me via messenger

View Rotem Bloom's profile on LinkedIn

Dream Theater Pics

Blogs I Read

ASP.NET MVC 3.0 jquery unobtrusive ajax Failed on IE 8

Hi All,

I'v notice a strange behavior when working with ASP.NET MVC 3.0 jquery unobtrusive ajax on forms HTML element on IE (internet explorer) 8.

Razor code example for generating ajax call on a form element using unobtrusive ajax: @using (Ajax.BeginForm("MyAction", "MyController",  new AjaxOptions { HttpMethod = "POST" })){

Sometimes (not always) i'm getting a javascript error with the message "Falied" that come from the javascript file jquery.unobtrusive-ajax.js:

The line is:

$("form[data-ajax=true] :submit").live("click", function (evt) {

Well the only solution I can find is to modify jquery.unobtrusive-ajax.js code with the following code:

$("form[data-ajax=true]").find("submit").live("click", function (evt) {

This fix the javascript error and the ajax call works always on IE 8.

Until now I can explain why the error happened only on IE 8 and was not reproduce permanently on each page refresh.

If it happened to you, I would be happy to know if you find other solution to this strange problem.

Rotem

Comments

Tomek said:

If I'm not wrong problem is with accessing to VML element, if jQuery access to a property which does not exist in VML element then every other property produces exception "Failed". VML elements draw graphics only on IE6, IE7, IE8. IE9 supports SVG.

When jQuery searches for ":submit" it access field

 submit: function( elem ) {

    return "submit" === elem.type;

 },

but VML element does not support access to ".type" property.

# May 8, 2011 10:08 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: