I want to access a PHP function from Ajax

Asked

Viewed 40 times

1

My doubt is the ajax URL, I want to know how to access the function of my class

Ajax with jQuery

    $.ajax({
        type:'post',
        url: "Usuario.php?apagar",
        data: {titulo: 'Ola mundo'},
        success: function( data ){
            $('#ajax').text(data);
        },
        error: function(){
            alert('Houve algum erro no ajax');
        }
    });

PHP

class usuario extends geral
{
    function apagar(){
         echo $_POST['titulo'];
    }
}

I have no idea what the URL looks like in Ajax.

  • No man, these topics that you are marking are not helping me :/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.