JQuery in internet explorer cant parse a string html -


i trying parse html string in internet explorer using jquery, based on: parsing html string ajax/jquery. here code:

alert(result); alert($(result)); 

the first alert prompts html, second alert gives me object. on firebug lite console gives me blank object: [] !!

console.log(result) console.log($(result)) 

result big xhtml code, received through ajax call. same code works on firefox..

anyone has idea why happening? appreciated..!

without seeing html code, it's hard say, have guess you're hitting "unknown runtime error" occurs when you're invalidly trying put element it's not allowed.

you see, jquery builds dom (x)html creating detached element , applying (x)html element's innerhtml property. fwiw, neither browsers care if you're passing xhtml or html, unless you're serving xhtml mime type giving bigger problems. if consider following plain js code:

var p = document.createelement("p"); p.innerhtml = "<li>test</li>"; 

internet explorer throw unhelpful "unknown runtime error", whereas firefox best salvage invalid html.

i recommend putting xhtml through w3c validator , checking validation errors.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -