??yy 2015-01-02 16:49 采纳率: 0%
浏览 48

jQuery / AJAX语法-PHP与ASP

I'm working on a tutorial that explains how to use jQuery to Get and Post data from an external page. The tutorials are generally simple, but this one is confusing because the external data is stored in pages with an .asp extension, which I know nothing about.

How should I modify the text from these pages so it works with PHP?

<%
response.write("This is some text from an external ASP file.")
%>

<%
dim fname,city
fname=Request.Form("name")
city=Request.Form("city")
Response.Write("Dear " & fname & ". ")
Response.Write("Hou live well in " & city & ".")
%>
  • 写回答

1条回答 默认 最新

  • weixin_33717298 2015-01-02 17:07
    关注

    In FE Script jQuery like this. "test.php"

      $.ajax({
        type: "POST",
        url: 'test.php',
        dataType: 'json',
        data: {"data":"check"},
        success: function(data){
            alert(data.value1);
            alert(data.value2);
        }
     });
    

    PHP Script

    <?php
        if(isset($_POST['data']) && $_POST['data'] == 'check'){
           //Data 1
             $data['value1'] = 'Data 1 Got Successfully';
            //Data 2
             $data['value2'] = 'Data 2 Got Successfully';
             $resonse = json_encode($data);
             echo $response;
        }
    ?>
    

    I hope you're aware of how to inject the response to DOM in AJAX success function

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效