0

ajax リクエストを tomcat サーバーに送信し、次のように応答を取得しています。

function getAgentName(){
    $.ajax({  
        type: "POST",  
        url: "agentName.html",

        success: function(response){
            // we have the response 

            if(response != null && response !="" && response !="null"){
                alert( "response  :"+$.trim(response)); // line 10
            }

        },  
        error: function(e){  
            alert('Error: ' + e);  
        }, 
        complete:function(){
            getAgentName();
        }
    }); 
}

as の成功alertの応答でエラーが発生しました 。line 10'$' is null or not an object

編集:私はすでに追加しましたJquery 1.9.1.js

これを解決する方法がわかりません。私たちのスタックユーザーが私を助けてくれることを願っています.

4

2 に答える 2

0

応答にエラーがある可能性がかなりあります。しかし、使用する代わりに、適切なショットを与えるためだけに

$.trim(response)

使用する

response.trim()

それでも問題が発生する場合は、応答に関連する問題であり、そうでない場合は既に問題を解決しています。

于 2013-10-24T10:14:10.597 に答える