Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Parsing Error in Firefox developer console

I have a jquery scripts which sends data to a java servlet and updates the content of the page basing on the servlet response. Everything works (the page gets updated with the values as I was expecting), but I can see in the developer console in firefox the following error:

XML Parsing Error: syntax error Location: http://localhost:8080/servlet_url Line Number 1, Column 1

This is my jQuery code:

 <script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
 <script type="text/javascript">
 $(document).ready(function() {
 $.post('servlet', {
 filepath : '${file}'},
 function(responseText){
 $('#div_id').text(responseText);
 });
 });
 </script>
like image 800
Antonio La Marra Avatar asked Mar 06 '17 16:03

Antonio La Marra


1 Answers

It seems that the issue occurred because I forgot to set the response content type in the servlet. So basically this line of code:

 response.setContentType("text/plain"); 

solved the problem.

like image 123
Antonio La Marra Avatar answered Sep 18 '22 05:09

Antonio La Marra