Get data from php array - AJAX - jQuery

前端 未结 5 1040
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 14:10

I have a page as below;





        
5条回答
  •  难免孤独
    2020-11-27 15:05

    you cannot access array (php array) from js try

    
    

    and js

    $(document).ready( function() {
        $('#prev').click(function() {
            $.ajax({
                type: 'POST',
                url: 'ajax.php',
                data: 'id=testdata',
                dataType: 'json',
                cache: false,
                success: function(result) {
                    $('#content1').html(result[0]);
                },
            });
        });
    });
    

提交回复
热议问题