jquery $.post function's result data

前端 未结 4 1168
死守一世寂寞
死守一世寂寞 2021-01-16 09:18

When I make an ajax call (see code below), what is \"data\". How do I set and get data

//  $.post()  
 $(\"#post\").click(function(){  
     $(\"#result\").h         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-16 09:46

    For example, I use:

    $(document).ready(function(){
    $("#btSend").click(function() {
        $.post("/Ajax/script.php", {nome: $("#nome").val(), email: $("#email").val()}, function(data) {
            alert(data);
        });
        return false;
    });
    

    });

    The script.php return what I want to show, but you can change to make another operation with 'data'. The 'btSend' is a image and the 'nome' and 'email' is html textboxes.

    This works :)

提交回复
热议问题