【问题标题】:Parameter in XMLHTTP AJAX post request is being altered in translationXMLHTTP AJAX 发布请求中的参数在翻译中被更改
【发布时间】:2016-01-14 11:05:05
【问题描述】:

只是一个快速的,我希望通过 XMLHttpRequest 方法中的字符串发送,并且在传输过程中遇到数据转换不正确的问题。这是我要发送的内容:

        xmlhttp.open("POST","create_table.php?", true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.send("steamID="+steamID);

steamID 在进入.send() 方法时如下所示:76561198000759657

当它出现在我的 php 页面中时,它看起来像这样:76561198000759660

对于不同的 steamID,无论如何它总是几乎四舍五入。知道如何防止这种情况发生吗?

非常感谢任何帮助。

【问题讨论】:

    标签: php ajax xmlhttprequest


    【解决方案1】:

    原来我需要在引号中调用我的 php 函数...

    所以:

    $().ready(function() {
        retrieveInventory(<?php echo $_GET['steamID']; ?>, 1);
    });
    

    需要:

    $().ready(function() {
        retrieveInventory('<?php echo $_GET['steamID']; ?>', 1);
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-03
      • 2015-12-30
      • 2012-02-16
      相关资源
      最近更新 更多