2016-07-06 11 views
0

実際、IOSプラットフォームのphonegapにajaxリクエストがあります。 example.com/folder/contact.php?id=idの2つのドメインがあり、もう1つは2です。example2.com/folder/contact.php?id=idios phonegapでクロスドメインが動作しない

URLが第2ドメイン(example2.com)、それは何も起こっていませんが、最初のドメイン(example.com)では正しく動作しています。私はconfig.xmlを設定しました。ここではアクセス元は "*"で、config.xmlにも設定されています。

何が問題なのか分かりません。私のAJAXコードは

$.ajax({ 
 
     type: 'GET', 
 
     url: ""+localStorage.url+"/folder/contact.php?id=" + Id, 
 
\t dataType: 'json', 
 
\t crossDomain: true, 
 
\t 
 
     data: { 
 
     name: name, 
 
     ph: ph, 
 
     email:email, 
 
     }, 
 
    success: function(response) { 
 
\t \t alert(response); 
 
}, 
 

 
error: function(error) { 
 
\t \t 
 
     navigator.notification.alert('Could not connect to the database'); 
 
     } 
 
    });

ですが、同じことは、Androidプラットフォームのために働いています。私のコードで何が間違っているか教えてください

答えて

0

私はこの問題を解決しました。実際には問題はページヘッダーメタコンテンツにありました。私はcontent gapにexample.comとexample2.comの両方のドメインについて言及しなければならない。このように

gap: https://ssl.gstatic.com https://*.googleapis.com http://example.com http://example2.com ;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://maps.googleapis.com https://maps.gstatic.com https://mts1.googleapis.com https://mts0.googleapis.com http://example.com http://example2.com ;object-src * ; style-src 'self' 'unsafe-inline' https://ssl.gstatic.com https://fonts.googleapis.com http://example.com http://example2.com ; media-src *;img-src *;font-src *"> 
関連する問題