jquery - How to make ajax request across sub-domain of the same website -


please need here! working jquery, ajax , php, wrote function (php_folder) this.

function php_folder(evt){  return "www.mywebsite.com/path/to/php/files/";} 

the purpose enable me call function + php file during ajax request. this:

$.ajax({ url:php_folder+'script.php',}); 

this works when current url http://www.mywebsite.com. not work when logged on http://mywebsite.com (without www.)

this error on error console:

xmlhttprequest cannot load http://www.mywebsite.com/script.php. origin http://mywebsite.com not allowed access-control-allow-origin.

please how can fix this??

instead of hardcoded url can read window.location , dynamically change value of domain.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -