XML parsing error in Firefox Developer Console

I have jquery scripts that send data to a Java servlet and update the contents of the page based on the response of the servlet. Everything works (the page refreshes with values ​​as I expected), but I see the following error in the developer console in firefox:

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> 
+5
source share
1 answer

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

  response.setContentType("text/plain"); 

solved a problem.

+7
source

Source: https://habr.com/ru/post/1265097/


All Articles