weixin_33698043 2019-01-23 17:37 采纳率: 0%
浏览 23


My files: signup.php, form.php, success.php, failure.php.

In signup.php there's an area <div id="myarea"></div>. Inside of this block I load the form.php by default via <?php include ("form.php"); ?>.

Now I want to show the success.php or failure.php whether the signup was successfull or not.

My Question: How can I replace the content/loaded file in myarea? (Until now I did not wrote the file the data of the form is sent to.)

EDIT: I'm new to php and so on

  • 写回答

1条回答 默认 最新

  • weixin_33698823 2019-01-23 17:51

    This is not using ES2017, but it is a simple example and will give you the general idea.

    I assume you are using ajax to verify the login, so something like below.

    When you come back from the ajax (that is, inside the ajax .done() or .success or whatever-you-use function, you can either use $.load() to load the new content and $('#myarea').html() to replace the content of the #myarea div, or even something as simple as $('#someHiddenDiv').show() to reveal a previously hidden div.

    Here is a simplistic example:

    var my_id = $('#loginid').val();
    var my_pw = $('#loginpw').val();
        type: 'post',
         url: 'ajax/login.php',
        data: 'id=' +my_id+ '&pw=' +my_pw,
        if (recd==1) {
            var newhtml = $.load('success.php');
            alert('Please try logging in again');

    Now that you see a very basic example, here is how we do it these days:

    How to do AJAX in 2018

    Understanding the Fetch API

    Async/Await in 2017




  • ¥15 霍尔传感器接放大器的应用
  • ¥20 针对计算后数据做一致性检验可以用Bland Altman法吗
  • ¥15 win32如何自绘编辑框的背景图片(语言-c++|操作系统-windows)
  • ¥15 微信夜间被转走了1w对,当天手机剪切板里就出现了这个乱码,有铁子可以看看是啥吗可以
  • ¥50 跑通github上的代码 深度学习 pytorch
  • ¥50 求写,批处理调用分区助手分区脚本
  • ¥15 求购HI3519AV100开发板
  • ¥15 请问1553 RT怎么测试,没有BC有方法吗
  • ¥100 业务编程如何选择学习方向和内容?
  • ¥15 wamp3.3.5安装完成后图标正常显示绿色,鼠标左右键点击图标均无反应。求解决方法。