I just encountered a problem when testing in visual studio with
开发者_Go百科XML Parsing Error: no element found
here Why do I need RegisterStartupScript for a simple jquery helloworld in asp.net?
whereas it was very simple code
Someone else has also gotten this error http://chiragrdarji.wordpress.com/2010/02/17/xml-parsing-error-no-element-found/
And I now remember in an enterprise project developped by some colleagues that I saw this error randomly for an asp.net application that uses ajax with updatepanels only on firefox not on IE. Since it was random it wasn't easy to catch it. Weirdly it did occur on IIS server not on visual studio localhost like the one above so the context may even vary.
So I'm worried about using ajax / jquery because it seems that the root cause is very difficult to find and solution even more.
So should one really go this route as it seems risky whereas Microsoft is promoting jquery it doesn't seem easy compared to using jquery with PHP as for reliability ?
Update: For the real world project of my colleagues of course ASP.NET is installed :). It works most of the time and then on some periods generate error only for FIREFOX NOT FOR IE.
This error is Firefox's way of saying the response from the server was blank. There are many causes for this error, including ASP.NET not being installed on IIS (need to run aspnet_regiis -i from Windows\Microsoft.Net\Framework\v2.*).
the problem is with IE which does not behave well u try to modify the dom structure when the html is still being constructed.
try using a delay="delay"
attribute on your script tag.
<script type="text/javascript" delay="delay">helloWorld();</script>
IE does not like if you try to modify the DOM structure when the html is still being rendered. this attribute tells the browser to delay script execution until it is done with the rendering.
精彩评论