0
I am working on a custom Wordpress page.
I am making a request via ajax on this custom page, which is theme directory:
wp-content/themes/my-theme/my-page-custom.php
The page that will process is also in the same directory, but does not work the ajax request, bringing back an error 404.
I believe I should do some procedure before I point out the right way, maybe...
Follows my code:
$(btMes).click(function(){
// REQUISIÇÃO --- V I A --- A J A X
var radioIn = $("input[name='radioVlrM']:checked").val();
var dtIC = $("input[name='singleMonth']").val();
$.ajax({
type:'GET',
url: 'processa.php',
data: {
'radioC': radioIn,
'dtiC': dtIC
},
success: function(result){
var view = $('#result_media').html(result);
$(table).show('slow');
} // End of success function of ajax form
}); // End of ajax call
return false;
});
In a well summarized way, WP does not allow you to make these requests to files belonging to the theme, because it does not make much sense. See that answer that I once gave that speaks exactly of this problem.
– Caio Felipe Pereira
Wordpress has some particularities of how to handle Ajax requests, see How to do Ajax in Wordpress the right way
– Ricardo Moraleida