I'm using jQuery to ajax a few items on my page. When I go to one of the pretty URL's that the htaccess file makes, it error's out. Here's the jQuery code I'm currently using:
$.ajax({
url: "inc/file.php",
success: function(result){
$('#NavMoreInfo').html(result);
navMoreInfoCloseButton();
$(":not(#NavMoreInfo)").click(function() {
$('#NavMoreInfo').slideUp(300);
});
},
error: function(event, request){
alert(request);
}
Here's my htaccess file:
DirectoryIndex master.php
# Enable Rewriting
RewriteEngine on
RewriteRule ^main/?$ master.php
RewriteRule ^(\w+)/?$ master.php?page=$1
How can I crossDomain my jQuery AJAX? Or is it something in my htaccess that I need to change? Any help is appreciated!
Thank you.
See jquery ajax documentation, for crossdomain requests :
crossDomain(added 1.5) Default: false for same-domain requests, true for cross-domain requests
If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain.
UPDATE **
You need to provide the FULL url of the requested website . This includes http:// or https://
in your case "http://www.mysite.com/inc/file.php"
I had to add http:// infront of my URL. For some reason, having the http:// www... was not working.
Removing the www worked.
Thank you everyone for the help!