2011-09-14 14 views
1

私のアプリケーションでは、単純なJquery Ajaxコールを使用していますが、動作していません。ここに私のコードですJquery AjaxコールがRhodesで動作しない

 try{ 
      $.ajax({ 
       type: "GET", 
       url: "http://xxxxxxx/sites/weed/chkuseremail_response.php?user_name=hhhhh&type=user&[email protected]", 
       async: false, 
       success: function(result) { 
         alert("result "+result); 
         alert("result.response "+result.response); 
         alert("result.error "+result.error); 

            var error = result.error; 
            var response = result.response; 
            if (error == null || error == "null") { 
             alert("welcome1"); 
            } 
            if (response == null || response == "null") { 
             alert("welcome2"); 
            } 

            }, 
             error: function() { 
               alert("welcome3"); 
               } 
             }); 

      }catch(e) {alert(e); 

}  

私はrhodes 3.0.2を使用しています。

+0

"not working"を定義します。 –

+0

ここで出力はresult = ""、result.response = null、result.error = null、3つのアラートをすべて取得しましたwelcome1、welcome2、welcome3 –

答えて

0

これは、ドメイン間のポリシーの制限が原因です。

セキュリティ上の理由から、サイトを閲覧しているときに、他のホストへのajaxコールはブラウザによって無効になります。

Rhodesアプリケーションでも同じことが起こっています。アプリケーションの同じドメインで実行されていないWebサービスを呼び出すことはできません。

JSONPを使用すると、外部JSONデータを取得できます。

+0

ご回答ありがとうございます。この問題はコールバックとjsonpで解決しました。 –

関連する問題