Hi, I am new to JQuery so hope I haven't just made a basic mistake. I am trying to insert a paragraph element containing data obtained from a .post request to a DB, into a page. I have it working perfectly in FF but it does not work in IE.
Here is the code; // make the request using .post and then using the returned data call the function $.post(URL, { component: componentVal, start: StartVal, end: endVal }, function(data){ rftStats(data); }, "json"); function rftStats(data) { $("#dataSet li").each(function() { var dataName = $(this).attr("id"); var valToGet = 'data.'+ dataName; var idSelector = '#'+ dataName; console.log(eval(valToGet)); $(idSelector).append("<p>" + eval(valToGet) + "</p>"); }); } The .append() function didn't seem to be working in IE. Therefore I tried numerous alternatives using functions such as text(), html(), createTextNode, etc. All carried on working in FF but not in IE. Therefore I decided to test it in another way. I altered my coded so that it would just append one value received back from the database. The code became; $.post(URL, { component: componentVal, start: StartVal, end: endVal }, function(data){ console.log(data.RFT); $('#RFT').append( '<p>' + data.RFT + '</p>' ); }, "json"); Again this worked in FF but not in IE. I then tried to simplify it more but just trying to append the word 'test' to a div called test. The code became; $.post(URL, { component: componentVal, start: StartVal, end: endVal }, function(data){ console.log(data.RFT); $('test').append( 'test' ); }, "json"); Again this worked fine in FF but failed once again in IE. I then moved the simple 'test' code outside of the .post() function; $.post(URL, { component: componentVal, start: StartVal, end: endVal }, function(data){ console.log(data.RFT); }, "json"); $('test').append( 'test' ); This worked in both FF and IE. Anyone go any suggestions? Can I not manipulate the DOM in the callback function of .post? Does anyone know how I can use the data received from the request elsewhere in my jquery code? I tried adding var receivedData = data.RFT; into the callback function and then use it elsewhere but to not good effect. There must be a way of getting data back from a DB and using it (inserting it) anywhere on the page in IE??? Anyway I am well and truly stuck and need help so please do....