簡體   English   中英

當我在 jQuery 中運行 $.get 時,我收到“object Object”。 為什么? 究竟是什么意思?

[英]When I run $.get in jQuery I receive "object Object". Why? What does mean exactly?

我從 jQuery 開始。 我嘗試通過 AJAX 請求向我的服務器發送一個對象,但我收到了object Object 這是什么意思? 這是我的代碼:

$(document).ready(function() {
    var endereco = "http://localhost:8082/teste/get.php?";
    $("#btnentrar").on('click', function() {
        var formulario = $("#formulario").serialize();
        var get = $.get(endereco + "&acao=teste&" + formulario, function(data) {
            alert(get);
        });
    });

    $("#configuracao").on('click', function() {
        activate_subpage("#subpagina");
        $("#formulario").hide();
    });
    $("#avancarconfig").on('click', function() {
        $(location).attr('href', 'index.html');
    });
});

你的 php 返回的數據包含在 $.get() 的成功回調中的data變量中:

$.get(endereco + "&acao=teste&" + formulario, function(data) {
  alert(data);
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM