Skip to main content

cross origin domain



I am trying to access a PHP file which is located in my domain but I want to do that using AJAX with jQuer. I am using a localhost and from there I am trying to call the PHP file here is the code I am using :







<script>

$(function() {



$("#callAjax").click(function() {

var theName = $.trim($("#theName").val());



if(theName.length > 0)

{

$.ajax({

type: "POST",

url: "http://studiofutbol.com.ec/upload_file.php",

data: ({name: theName}),

cache: false,

dataType: "text",

success: onSuccess

});

}

});



$("#resultLog").ajaxError(function(event, request, settings, exception) {

$("#resultLog").html("Error Calling: " + settings.url + "<br />HTPP Code: " + request.status);

});



function onSuccess(data)

{

$("#resultLog").html("Result: " + data);



$('#people_list').append("hola");

$('#people_list').listview('ref resh');

}



});

</script>







But I get this error:







XMLHttpRequest cannot load http://studiofutbol.com.ec/upload_file.php . Origin http://localhost is not allowed by Access-Control-Allow-Origin.







How can I solve this?


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?