dtmjl4427 2014-09-17 17:39
浏览 19
已采纳

JS和PHP - 从js发出信号后加载php数据而不发送回发

Alright so basically I have a flash login, which I handled to work with JS using ExternalInterface. I want the php to load only when the user has logged in, how is it possible to do this without sending a new postback (reloading the page)?

What I basically want is: the JS already appears once the user has logged in. I want it once clicked to execute a MySql query, get the data and show the user without reloading the page.

I know that's AJAX but I really don't know how to do it - I'm not familiar with php, I also don't know how I can run the php when a function is called in JS.

Best regards, iMix

  • 写回答

3条回答 默认 最新

  • dsm17496 2014-09-17 17:56
    关注

    You can use jquery, it would be a quick and practical solution.

    function login(){
      $.ajax({
        type: "POST",
        url: "your_login_script.php",
        data: { username: "thatuser", password: "thatpwd" }
      }).done(function( result ) {
        alert(result);
      });
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度