Ajax错误:页面的完整地址

时间:2014-04-22 23:37:57

标签: javascript jquery ajax

我试图在这里将完整地址调用到所请求的页面,但我得到xhr的[object Object]。这不应该返回完整的地址而不是xhr的[object Object]的引用。

function isValid(frm){
 $("#courseinfo").hide();
 $("#frm").validate();
 var dropDownSelected = $("#frm :selected").val();
     if (dropDownSelected == "404")
        {
    var txt = ($(this).text());

    $.ajax({url:"404_error.json", 
        data:{coursename:txt}, 
        type:"GET", 
        dataType:"json",
        success:fnsuccess, 
        error: function(xhr, status, error){
          $("#infohere").text("Error: " + xhr + " - " + xhr.status + " - " + error);
          $("#courseinfo").show();
         }
        }); // end of ajax                                      
 } // end of if 404

1 个答案:

答案 0 :(得分:0)

如果我想要返回一个URL,我需要写出URI或使用类似于JavaScript的document.documentURI。我原本期望URL在XHR中用于JSON,但事实并非如此。