I am working on an asp.net mvc app that loads data via ajax. In the response html there is a script element that contains the client side validation for the data being passed down. I can see the script in the reposnse object, but after I call $(target).html(data); and view the page source the script tag was not inserted. Is there a way to keep jQuery from removing the script tag from ajax data?
jQuery isn't removing your script tags. When you view a page's source through the browser, the browser is showing you the source for the page as it loaded. If you wish to see changes made after the page loaded, you need to use a DOM inspector such as Firebug or Developer Tools.
My mistake on saying view source. I actually am using firebug and inspecting the result. That is how I was able to see the request come back from the call and see that once it was added to the document that the script was pulled out.
I included files from firebug. The file "partial loaded with page" is the result of rendering the partial with the page. Script tags are intact with the docuemnt. The file "response from post" is what firebug shows as the response from my ajax call (script tags in tact). The file "page after ajax call" is what firebug shows as the document after the ajax response has been added (script tags are removed).