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

10 באפריל 2011

one comment

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

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

one comment

  1. Tomek8 במאי 2011 ב 22:08

    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.

    Reply