1

i am beginner to Phonegap, here i am executing this reference code in Android Emulator and working in phonegap 2.0 to get simple output. After running this code, Logcat shows the following error: xmlHTTPrequest cannot load http://api.careerbuilder.com/v1/jobsearch?DeveloperKey? origin null is not allowed by access control-Allow origin here html code:

<div data-role="page" id="page1">

<div data-role="header" data-theme="b">

<p><center>Career Builder</center></p>

</div>

<div data-role="content" data-theme="d">

<input type="text" id="t1" placeholder="Location....">

<input type="button" id="but" value="Search" onclick=show()><br>

<ul id="list" data-role="listview" data-theme="a" data-filter="true">




document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
}

function show() {
var val=document.getElementById("t1").value;

$.ajax({

type: "GET",

url: "http://api.careerbuilder.com/v1/jobsearch?&DeveloperKey= my api key",

contentType:"xml/application",

data:{

val:val,

},

dataType: "xml",

success: function(xml)

{

xmlParser(xml);

}

});

}

function xmlParser(xml) {

$(xml).find("JobSearchResult").each(function () {

var com=$(this).find("Company").text();

var job=$(this).find("JobTitle").text();

$("#list").append
('<ul><li>Company Name :' + com + '</li><li>Job Title :' + job + '</li><ul>');

$('#list').listview('refresh');

});

}
4

1 に答える 1