Help, I have a file structure in mvc for php, and everything that is written in the url goes through the public / index.php folder. which accesses the folder app / iniciador.php which loads the classes with the views, drivers and models.
The problem is that when using ajax I can not find the requested url, I guess it's because of the mapping of what I do in the .htaccess file, this is my code.
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteBase /norbeV1/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
request code in js:
$(".FormularioAjax").on("submit",function(e){
e.preventDefault();
var form=$(this);
var tipo=form.attr("data-form");
var metodo=form.attr("method");
var formuData={"usuarioCedula":"010518278"};
formuData=JSON.stringify(formuData);
$.ajax({
type:metodo,
url:"http://localhost/norbeV1/app/ajax/administradorAjax.php",
data:{"datos":formuData},
error:function(jqXHR){
console.log(jqXHR);},
success:function(data,textStatus,jqXHR){
respuesta.html(data+"/"+textStatus);
}
});
}
and this is the one that receives:
<?php
$data=json_decode($_POST["datos"]);
print_r($data);