/ Published in: jQuery

Enviar datos por medio de $.ajax, propidad de jquery que permite ocupar ajax con php en jquery, se puede ocupar para cualquier cosa
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// documento principal $(document).ready(function(){ $("#send_contact").click(function(){ var nombre = $("#nombre").attr("value"); var email = $("#email").attr("value"); var tip_contact = $("#tip_contacto").attr("value"); var texto = $("#mensaje").val(); $.ajax({ type: "POST", url: "<?=get_template_directory_uri()?>/send_contacto.php", data: "nombre="+nombre+"&email="+email+"&tip_contact="+tip_contact+"&texto="+texto, success: function(msg){ alert( "Su mensaje ha sido enviado" ); } }); }); }); // DOCUMENTO QUE LLAMA send_contacto.php $nombre = $_POST['nombre']; $email = $_POST['email']; $tip_contact = $_POST['tip_contact']; $texto = $_POST['texto']; $date = date('Y-m-d'); $sql = mysql_query("INSERT INTO $table_name(id,nombres,mail,asunto,mensaje,fecha_envio)VALUES(NULL,'$nombre','$email','$tip_contact','$texto','$date');",$link);
Comments
