dreamsweaver
Bovino maduro
- Desde
- 14 Dic 2008
- Mensajes
- 277
- Tema Autor
- #1
(Ya lo solucioné)
Hola bakunos, necesito su ayuda con un script Jquery-AJAX
Lo que pasa es lo siguiente: Al recibir los datos en el PHP no recibe ningun dato y por lo tanto no ejecuta nada, el PHP es el siguiente:
Espero su ayuda y gracias de antemano
Ya resuelto me queda así:
Hola bakunos, necesito su ayuda con un script Jquery-AJAX
$("#form1").submit(function(e){
var name = $("#nombreN").attr("value");
var path = "";
if($("#raiz").attr("checked") || $("#actual").attr("checked") && name.length > 0) {
if($("#raiz").attr("checked")) {path = $("#raiz").attr("value");}
if($("#actual").attr("checked")) {path = $("#actual").attr("value");}
$.ajax({
async: true,
type: "POST",
dataType: "html",
contentType: "aplication/x-www-form-urlencoded",
url: "procesos.php",
data: {pathath, nombre:name, ajax_create:1},
beforeSend: function(){$("#formaNew").find("div.response").show().html("<img src='iconosvista/ajax-loader.gif'>")},
success: function(dato){$("#formaNew").find("div.response").show().text(dato)},
timeout: 6000,
error: function(){$("#formaNew").find("div.response").show().text("Problemas en el servidor")}
});
} else alert("Error");
e.preventDefault();
});
Lo que pasa es lo siguiente: Al recibir los datos en el PHP no recibe ningun dato y por lo tanto no ejecuta nada, el PHP es el siguiente:
En si el PHP no tienen ninguna dificultad, el problema está con el JQuery.require_once("funciones.php");
if(isset($_REQUEST['ajax_create'])) {
$nombre = $_REQUEST['nombre'];
$ruta = $_REQUEST['path'];
crearDir($nombre,$ruta);
}
Espero su ayuda y gracias de antemano
Ya resuelto me queda así:
$("#form1").submit(function(e){
var name = $("#nombreN").attr("value");
var path = "";
if($("#raiz").attr("checked") || $("#actual").attr("checked") && name.length > 0) {
if($("#raiz").attr("checked")) {path = $("#raiz").attr("value");}
if($("#actual").attr("checked")) {path = $("#actual").attr("value");}
$.ajax({
async: true,
type: "POST",
dataType: "html",
contentType: "application/x-www-form-urlencoded",
url: "procesos.php",
data: {pathath, nombre:name, ajax_create:1},
cache: false,
beforeSend: function(){$("#formaNew").find("div.response").show().html("<img src='iconosvista/ajax-loader.gif'>")},
success: function(dato){
$("#formaNew").find("div.response").show().html(dato);
$("#formaNew").parent().delay(5000).hide(500);
$("#formaNew").find(":text").delay(5000).attr("value","");
$("#formaNew").delay(5000).toggle(500);
setInterval(function(){window.location.reload();},5000);
},
timeout: 6000,
error: function(){$("#formaNew").find("div.response").show().text("Problemas en el servidor")}
});
} else alert("Error");
e.preventDefault();
});