So I am doing a custom ajax call in WordPress. The problem is that it is quite a big task that this ajax call is doing and before it completes the task WordPress presents me with a 404 error page Has anyone else had this experience? Any solution for this?
A 404 code is a "Not Found" error. I do not know why a 404 would be returned. Usually that happens when a file does not exist. Could this be a timeout problem, such as exceeding PHP's max_execution_time? Or perhaps the web server timing out?
If you're doing an Ajax-call, it should NOT end in a 404 - an ajax-call should return an error or nothing at all if the source isn't found, or similar. As others have stated, a 404 error means the page you're trying to reach isn't there - and as this is an ajax-call, it shouldn't redirect - it should load the content (or whatever you're fetching via ajax) on the page you're already on. What exactly are you trying to do?
Are you loading wordpress on a custom page outsite of wordpress i.e; using: require($wordpress_dir.'/wp-blog-header.php');? You may want to add: header("HTTP/1.1 200 OK"); on the page. This is a common problem for ajax requests in Wordpress. Add the header after loading wordpress to replace Wordpress 404 header.
your ajax string to pass variables and pull data back for PHP is obviously pulling a URL back instead of raw data and is trying to access a bad or non-existent URL re-read your multiple string Ajax code where youre passing the vars GET methods . not the top 'engine' code, only at bottom with the stack of GET method var passing method, youre pulling a URL or what the PHP on return is using like a header or page redirect. If it for sure isnt any of that, then your htaccess file might be redirecting for whatever reason and you forgot that it was doing that.