Hayling Island Internet Marketing and Technology Blog
£300CMS
A Content Management System can give you the power to control the content on your web site. Our CMS is a fully featured mature piece of professional software it also comes with a remarkable price tag.
- A custom designed template
- Edit your content
- A web form
Jquery's $ Ajax function breaks in IE
Using the $AJAX call in IE was giving me the error: The data necessary to complete this operation is not yet available.
I was using this code below, which I had taken from the jquery site.
editUser = $.ajax({
url: "lib/includes/action.editUser.inc.php",
global: false,
type: "POST",
data: ({id : id, brand : brand}),
dataType: "html",
success: function(msg){
//insertID = msg;
}
}
).responseText;
My solution to the problem is below.
var editUser = $.ajax({
url: "lib/includes/action.editUser.inc.php",
global: false,
type: "POST",
data: ({id : id, brand : brand}),
dataType: "html",
success: function(msg){
// do function here
}
}
);
As you can see, the code is fairly similar, the two parts that needed to be changed were the VAR declaration at the start and removing the .responseText. The reason why this failed was because, the browser was trying to load the information before the code executed. But with this you can still execute your code by creating a function or a call to a function in success: part of the code.
This was a horrible realization when deadlines are looming.