The parameter *return_value* contains
<textarea>{"id":43,"description":"","item_id":28,"callback":"addNewAttachment","filename":"foo.jpg",,"type":"posts","ext":"jpg","size":145}</textarea>
The next code removes the textarea tags in Firefox, Chrome, so the content can be accessed in arr[1]. In IE alert("Failure") is called.
function addAttachment(returned_value) {
var re = new RegExp ("<textarea>(.+)</textarea>");
var arr = re.exec(returned_value);
if(arr != null && arr.length > 1) {
var json = eval('(' + arr[1] +')');
} else {
alert("Failure");
}
window[json.callback](json);
}
*returned_value* comes from an ajax call. I use JQuery.
TEST
This does not work either:
var re = new RegExp (/<textarea>(.+)<\/textarea>/);
SOLUTION
The problem was that IE was getting the textarea String uppercased while firefox was getting it lowercase.
The next regular expression solves it.
var re = new RegExp ('<textarea>(.+)</textarea)>','i');