【问题标题】:TidesSdk ajax post - phpTidesSdk ajax 发布 - php
【发布时间】:2014-10-02 20:13:38
【问题描述】:

我正在使用tideSdk 使用php 和jquery 创建应用程序这是我的代码 jQuery:

$(function(){
        $('.button').on('click',function(){
    Var name = $('.nameF').val();
    $.post('index.php',{create:"",name:name},function(e){
    Alert(e);
    })
    })})

php (index.php):

<?php
If (filter_has_var(INPUT_POST,'create')){
Echo $_POST['name'];
Exit();

}

?>

HTML:

<input type="text" class="nameF"><input type="button" value="save" class="button">

返回值是 html 代码而不是我发布的名称,当我使用互联网浏览器时它可以正常工作,但在 titesdk 中正在警告 html 代码

【问题讨论】:

    标签: php jquery html ajax tidesdk


    【解决方案1】:

    在 TideSDK 中,ajax 请求的方法总是 GET

    .post 不可能

    .得到确定

    对于表单,方法是自动 GET,而不是 POST

    示例:

    <form action="miphpfile.php" name="mi_form">
    </form>
    

    这个表格是自动用GET方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 1970-01-01
      • 2021-02-24
      • 2016-12-14
      • 2014-04-04
      • 2012-01-22
      相关资源
      最近更新 更多