HOME > Client Script Forum > error XMLHttpRequest cannot load http://192.168.2.53:8080/mobileDX2/index.php/main/gettest?callback=?start=1&limit=5. Origin null is not allowed by Access-Control-Allow-Origin. แก้ไงค่ะ
error XMLHttpRequest cannot load http://192.168.2.53:8080/mobileDX2/index.php/main/gettest?callback=?start=1&limit=5. Origin null is not allowed by Access-Control-Allow-Origin. แก้ไงค่ะ
<script>
$(document).ready(function()
{
var url = URL_JOBORDER_LISTALL;
var vals = "callback=?start="+start+"&limit="+limit;
$.getJSON(url , vals , function(rws) {
alert("1");
$('#tweet-list').empty();
start = val.start;
alert("2");
for(var i=0 ; i < rws.data.length ; i++){
//TimeStamp change Date from 1301090400 = 2013-05-14
var date = new Date(rws.data[i].created*1000);
var postdate = date.getDate()+"-"+(date.getMonth()+1)+"-"+date.getFullYear();
//format Date
var pick = rws.data[i].jd_location_1_datetime;
var pickup = pick.substring(0,10).split("-");
var pickupdate = pickup[2]+"-"+pickup[1]+"-"+pickup[0];
var deli = rws.data[i].jd_location_2_datetime;
var delivery = deli.substring(0,10).split("-");
var deliverydate = delivery[2]+"-"+delivery[1]+"-"+delivery[0];
$('#tweet-list').append('<tr><td rowspan=7 scope=col>'+'<img src="file:///android_asset/www/img/car/10 wheels.png"/>'+'</td><td scope=col>'+val.data[i].title+'</td></tr>');
$('#tweet-list').append('<tr><td>'+"Routeval : "+rws.data[i].p_orgin+" - "+rws.data[i].p_detination+'</td></tr>');
$('#tweet-list').append('<tr><td>'+"Post Date : "+postdate+'</td></tr>');
$('#tweet-list').append('<tr><td>'+"PickUp Date : "+pickupdate+'</td></tr>');
$('#tweet-list').append('<tr><td>'+"Delivery Date : "+deliverydate+'</td></tr>');
$('#tweet-list').append('<tr><td>'+"Job NUmber : "+rws.data[i].jo_number+'</td></tr>');
$("#tweet-list").append('<hr>');
}
});
});
</script>