Why is jQuery ajax get returning a 404 Not found error even while the file exists on the server?


When I access the following url via browser it works fine returning JSON data,

<a href="http://azcvoices.com/topcompanies/wp-content/themes/topcompanies/get.php?p=33" rel="nofollow">http://azcvoices.com/topcompanies/wp-content/themes/topcompanies/get.php?p=33</a>

When jquery does an ajax get it is failing with a 404 Not found error with the following code even when the file get.php truly exists on the server as mentioned above,

$.ajax( { url: "http://azcvoices.com/topcompanies/wp-content/themes/topcompanies/get.php", type: "GET", data: {p: postId} }) .done(function(post) { }) .fail(function() { alert("error"); }) .always(function() { });

You may see the 404 error below, <img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/RVdgY.png" data-original="https://i.stack.imgur.com/RVdgY.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Currently the .htaccess has the following in it,

RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] RewriteRule . index.php [L]

Could this be causing the issue?

The same demo on the test server at, <a href="http://peplamb.com/workspace/azcentral.com/spotlight-stories/" rel="nofollow">http://peplamb.com/workspace/azcentral.com/spotlight-stories/</a> works fine, but the same code is failing at <a href="http://azcvoices.com/topcompanies/spotlight-stories/" rel="nofollow">http://azcvoices.com/topcompanies/spotlight-stories/</a>

What could be the issue? Any help is greatly appreciated!


Are you making the request from the same domain as the page is hosted on? If not, you might be running into a problem with <a href="http://techblog.constantcontact.com/software-development/using-cors-for-cross-domain-ajax-requests/" rel="nofollow">Cross-Origin Resource Sharing</a>.

To fix this, you might be able to add Access-Control-Allow-Origin: * as a header.


  • 【原创】想了解Mysql事务,知道这些就够了
  • Using reflection to instantiate a Java class from a .class file
  • Release a message back to SQS
  • Navigation Service in WPF
  • Running ASP.NET Web Api 2 application without Visual Studio
  • Download local file in angularJS
  • How to efficiently work with multiple database tables in Ruby on Rails
  • When scaling and drawing an image to canvas in iOS Safari, width is correct but height is squished
  • Delete get variables and .php using htaccess
  • Identifying dates in strings using NLTK
  • Arc gradients in Flutter?
  • Eric5: The OK button of 'new project' dialog is disable
  • jQuery - Prevent activation on first click
  • read.table returning character matrix, would like numeric
  • Python ctypes: Prototype with LPCSTR [out] parameter
  • Google TV VideoView playing YouTube rtsp videos
  • cSPADE data mining in R using arulesSequences - Error while converting to “transactions” format
  • Haskell program that can handle any arbitrary deterministic finite automaton
  • What does “T extends Junk” mean in a generic class in Java?
  • How to create subsets of a single set of elements with XSLT?
  • Create an average of multiple excel chart without the data source
  • how to run ejabberd with Erlang on Heroku?
  • How to use Streams api peek() function and make it work?
  • Terminal run dalvikvm with am.jar
  • How to specify generic type when the type is only known at runtime?
  • Using redis as an LRU cache for postgres
  • `$http:badreq Bad Request Configuration` - from angular post method, what is wrong here?
  • How to decleare char *const argv[] in swift [duplicate]
  • How to handle div that is created dynamically in a table
  • Did not understand process of initialize in swift programming
  • How to encrypt Connectionstring written in web.config from codebehind?
  • How to get rgb from transparent pixel in js
  • Make checkout phone field optional for specific countries in WooCommerce
  • Firebase: How to read from external DB?
  • WPF custom control and direct content support
  • ReferenceError: TextEncoder is not defined
  • Create/delete users from text file using Bash script
  • Time Complexity of Fibonacci Algorithm [duplicate]
  • How to check if object is null in Java?