Today while working with JQuery-Ajax, I found an interesting error. I have used $.ajax() function to retrieve data from remote page. While testing I found that the page always show error : XML Parsing Error: no element found. Error does not contain specific information about the source of error. The common reason for XML Parsing Error: no element found is missing closing tag for one or two html element, so I double checked everything to make sure not miss any closing(</td> </tr>) tags.
After searching for while I found that somehow ASP.NET treat the response of page as XML document and that’s why we receive XML Parsing Error: no element found error.
To solve this error I added a line Response.ContentType = "text/HTML" to .cs page. This line tells ASP.NET runtime that response is HTML text and not XML.
Happy Programming!!!
good day sir.. where did you add that code.. what specific location?
Hi
where did you add that code.. what specific location?
I mean at which event…
Hi,
My problem is : Same page running fine on one server and returns “XML Parsing Error: no element found” on another server.
I added Response.ContentType = “text/HTML”; before Response.Write. but still not working.
Such error can be caused by many things… not just content type mismatch.
If you are working dates and using DateTime type, be sure that you actually fill out the property/ field before serving.
Don’t leave properties empty, check for null-values.
It is a very stupid error telling you nothing. Reminds me of “Error occured”… *LOL*
Hi,
I encountered the same error see
http://stackoverflow.com/questions/3866511/why-do-i-need-registerstartupscript-for-a-simple-jquery-helloworld-in-asp-net
but couldn’t solve using content type ?
the reason for that is some mobile browsers don’t know how to handles in line javascripts
so if you put all your scripts in a file it will work try it
I’m not particularly savvy when it comes to the computer. I need a simple answer to the phrase ‘form not found’. Please help.
I have been getting parser or invalid on my kodak creative projects I contacted kodak they said microsoft I defraged my computer updated kodak still get error not on any other kodak attachment days working on this I’m not savvy so help me if you can with easy explanination Hepl please
Thanks a lot! It worked just fine! The problem was that a query wasn’t returning a result and the Response.Write was returning an empty string, but jQuery turned that into a “[XML Parsing Error: no element found]”. With the Response.ContentType, jQuery returns an empty string.
here i can add this
Response.ContentType = “text/HTML”; before Response.Write. but still not working.
ok