/* EXCLUIR ARQUIVOS DA GALARIA */
$(document).ready(function() {
/* EXCLUI ARQUIVOS DA GALERIA IMG E PDF */
$( "#btnexcluipdf" ).bind( "click", function() {
var vID = $('#idarquivopdf').val();
//alert(vID);
//$("#status").html(
// "ID excluido: ");
var vurl = '?pg=excluirarquivo';
var vData = {id:vID};
$.ajax(
vurl
,vData
,function(response,status){
if(status == "sucess")
{
var obj = jQuery.parseJSON(response);
$("#status").html(
"ID excluido: " + obj.id );
}
}
);
});
o php...
<?php
header('Content-type: application/json; charset=utf-8');
var_dump($_POST);
//$id = $_POST["id"];
?>
deixei o codigo assim.
/* EXCLUIR ARQUIVOS DA GALARIA */
$(document).ready(function() {
/* EXCLUI ARQUIVOS DA GALERIA IMG E PDF */
$( "#btnexcluipdf" ).bind( "click", function() {
$.ajax({
method: "POST"
,url: document.location.pathname + '?pg=excluirarquivo'
,data: { id: $('#idarquivopdf').val() }
,dataType: "html"
})
.done(function( resposta ) {
alert(resposta);
}).fail(function(jqXHR, textStatus) {
alert("Erro:" + textStatus);
}).always(function() {
alert("OK");
});
});
ao clicar, o evento (alert(resposta);) mostra uma pagina html, depois ele passa pelo done e não mostra nada, mas chega ao final no OK.
bind
paraon
e$.ahax
para$.ajax
$.ajax({ url: vurl, data: vData
... Veja o link da documentação que o @ValdeirPsr passou!