小编Adr*_*ian的帖子

即使查询成功,也会执行JQuery ajax错误函数

我正在尝试学习JQuery - 我对ajax有一个小问题.我正在尝试使用页面的XML响应返回的值填充javascript数组.
这是我的主页(ajax.html):

<html>
<head>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/fiber.js"></script>
</head>
<body>
<p>Ajax</p>
<script>
var ringType = new Array();

</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

fiber.js是这样的:

//process things for fiber map
jQuery(document).ready(function() {
// do stuff when DOM is ready

//populate and display ringType
$.ajax({
  type: "GET",
  url: "ajaxHelper.pl",
  data: {
      getRingTypes: "1",
      },
  dataType: "xml",
  success: function(xml) {
      //if the query was successfull,
      alert("Got an xml object:"+$(xml));
      $(xml).find("ringType").each( function(){
          alert("Received reply "+$(this).text());
          var type = $(this).html(); //save the value
          //append …
Run Code Online (Sandbox Code Playgroud)

xml ajax jquery

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

ajax ×1

jquery ×1

xml ×1