consider i have created a website and have a web directory like this...
1.index.php
2.ajax.php
In index.php coding.. i use
<html>
....
<base href="http://website.com">
....
....
<script> <!-- using jquery -->
....
$.ajax({
url:'ajax.php',
type:'POST',
data:{ 'variable': value },
success: function(res){
....
....
}
});
....
</script>
when i run above code it works fine... but when i add "www" in base element href attribute, like this...
<base href="http://www.website.com">
its not working why?, it show error like this in javascript..
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://example.com/ajax.php. This can be fixed by moving the resource to the same domain or enabling CORS.
now i have question?
what is the real problem?
what should i do to make both base element code should run?
what is CORS enabling?
if i enable CORS, anyone from other website can able to access my site?
I would appreciate if some one could assist me, thanks in advance...