Sending PHP json_encode array to jQuery

前端 未结 4 1437
攒了一身酷
攒了一身酷 2020-12-10 22:07

ok, i guess I need help ! I searched with every keyword I could think off, but I still cant figure out, please help. Am more of a php guy, and I\'ve just started with jQuery

4条回答
  •  情深已故
    2020-12-10 23:02

    Try setting the dataType option:

    $.post('myCalculator.php' ,{qid:itemID},function(response)
    {
        $("div.calculation_value").show(500).html(response['calculatedValue']);
        $("div#message_for_user").show(500).html(response['message']);
    }, 'json');
    

    NB I have also added the closing brackets ) where you have missed them.

提交回复
热议问题