Strange Jquery Error In Ie: Unexpected Call To Method Or Property Access
Like allways, in Firefox, Chrome, Safari and Opera everything works without a problem. But IE... This is another story :) Here is my full code: http://pastebin.com/ZdzzFayJ At leas
Solution 1:
For me the problem was the following:
i use a lib where is applied on all environment.
my_lib.js
jQuery.ajax({
data : jQuery('form').serialize(),
url : '/'+action[1]+'/post_form',
type : 'POST',
dataType: 'json',
success: function(data){
$('#my_name_id').find('option').remove().end().append(data.select_options);
});
Json returns:
select_options "<option></option>"
Everything is fine! BUT, in one form #my_name_id is not a select, is a hidden field, it's a pre-selected value and disabled attribute for the user.
That's why jquery on IE8 retrieves me the error.
The solution was:
my_lib.js
jQuery.ajax({
data : jQuery('form').serialize(),
url : '/'+action[1]+'/post_form',
type : 'POST',
dataType: 'json',
success: function(data){
if( $('#my_name_id').is('select') ) {
$('#my_name_id').find('option').remove().end().append(data.select_options);
}
});
Hope it helps somebody!
Solution 2:
You appear to be missing a semi-colon in your get_data function after echo_data(data)
.
request.done(function(data) {
if (data) echo_data(data) _loading.hide();
_ads_listing.unmask();
});
Solution 3:
I solved the problem in the following way:
- Clean up my code ( JSHint was very helpful! )
- Before anything I included
"//html5shiv.googlecode.com/svn/trunk/html5.js"
to IE recognize that I am using HTML5 tags such as section, header,... - In jQuery plugin I fill element with html content. Instead of using
$(defaultOpts.data_container).html("HTML CONTENT")
I usedefaultOpts.data_container.html("HTML CONTENT")
. So I send object element$(#ID)
in parameter to plugin instead of sending just element ID"#ID"
.
Now, everything working OK. Thank you all for your support and effort.
Post a Comment for "Strange Jquery Error In Ie: Unexpected Call To Method Or Property Access"