Answer the question
In order to leave comments, you need to log in
Parsing an XML file with Ajax. Why am I not getting an Ajax request response?
Good afternoon everyone. I couldn't find an answer to my question, so I'm posting here. I understand Ajax. I found only one similar question: https://toster.ru/q/85194 , but here the person had an error, at least, which indicated problems with access, but everything seems to work perfectly for me, no errors in the console, no answers from the server. The task is this:
You need to parse an XML file in order to then convert it into an HTML page. Because xml file is a table, then, in my opinion, it is more convenient to parse it through jQuery. I'm trying to get XML through Ajax, but the result is 0, no errors, no result. At first I thought that the problem was in access, but according to HTTP headers everything is fine, in the logs of the OpenServer that I use, there are also no problems, everything is OK, 200 response, which is logical, but I'm not breaking into another server. What could be the problem, please explain.
HTML code:
<!DOCTYPE html>
<html lang="ru" >
<head>
<meta charset="utf-8" />
<title>AJAX в jQuery</title>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/sripts.js" type="text/javascript"></script>
</head>
<body>
<div class="transform">
push
</div>
</body>
</html>
jQuery(document).ready(function() {
jQuery(".transform").click(
function() {
jQuery.ajax({
type: "GET",
url: "files/test.xml",
dataType: "xml",
error: function() {
console.log("Не вышло");
},
sucess: function(temp) {
console.log(temp);
}
});
}
);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question