我正在使用 phonegap android 开发一个应用程序。当我运行这段代码时,它给出了以下错误
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<title>Insert title here</title>
<script>
(function($) {
$.fn.getPageData = function() {
var finalData = "";
$.ajax({
url : "Demo url.com",
type : "GET",
success : function(data) {
finalData = '<div id="index" data-role="page" data-url="index" tabindex="0" class="ui-page ui-body-c ui-page-active" style="min-height: 386px;"><div data-role="header" class="ui-header ui-bar-a" role="banner"><h3 class="ui-title" role="heading" aria-level="1">First Page</h3></div></div>';
},
fail : function() {
finalData = '<div id="index" data-role="page" data-url="index" tabindex="0" class="ui-page ui-body-c ui-page-active" style="min-height: 386px;"><div data-role="header" class="ui-header ui-bar-a" role="banner"><h3 class="ui-title" role="heading" aria-level="1">Error Page</h3></div></div>';
}
});
this.append(finalData);
};
})(jQuery);
$(document).ready(function() {
$('body').getPageData();
//$(a).appendTo("body");
});
</script>
</head>
<body>
</body>
</html>
它给出了以下错误。
Origin null is not allowed by Access-Control-Allow-Origin.