douci2015 2015-11-14 17:59
浏览 33

通过AJAX通过PHP获取数据无法正常工作

I am having problems getting data from a server using a combination of generating the data through PHP and using an ajax method to retrieve it.

I want to get the data through GET within receive.php that calls get_data.php

My ajax function located within receive.php:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type = "text/javascript">
    $.ajax({
       url: '<website>/get_data.php',
       data: {
          format: 'json'
       },
       error: function() {
          $('#info').html('<p>An error has occurred</p>');
       },
       dataType: 'jsonp',
       success: function(data) {

        console.log(data);

       },
       type: 'GET'
    });
</script>

get_data.php:

<?php
...
$data = array('a','b','c');
$data = json_encode($long);
echo $data;

?>

When I run receive.php I get an ajax error: GET 404 error.

What am I missing?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?