So I have a form which is sent to a python script via ajax. The python script is outputting an entire HTML page which includes content type doctype and all that.
Now I need to insert a part of the response text from the python script, a div element, into a div on the current page.
How do I parse the response text and strip away all of the unnecessary junks like doctype and header?
Thanks.
In your success function you have to filter the result like this:
I created a working fiddle for you here.
That’s the solution for your question, but jimw is right with his comment about changing the script to output just the content, that would be the correct solution.