dongxun4110 2014-03-30 14:13 采纳率: 0%
浏览 77

使用AJAX / JSON返回整个文件

I have one file with a long script which has a variable "period" in it. I will send the value of that variable via the front page of the site to that file. The value will be filled into the file and return it to the front page. So I want the code <code period="x"> placed in the front page as something like <code period="1">

I want to do that multiple times with different values. Does someone know how this can be done?

I saw this script, but it didn't work:

if($error === false) {
alert($error);
$.ajax({
    url: '\get.php',
    type: 'POST',
    dataType: "json",
    data: {
        period: "1"
    },
    success: function(data){
        alert(JSON.stringify(data));
    }
});

Thanks

  • 写回答

3条回答 默认 最新

  • douxu9707 2014-03-30 14:15
    关注

    You have a syntax error. See the inline comment:

    if($error === false) {
        alert($error);
        $.ajax({
            url: '/get.php',
            type: 'POST',
            dataType: "json",
            data: {
                period: "1"
            },
            success: function(data){
                alert(JSON.stringify(data));
            }
        });
    } // << this was missing
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分