2015-01-28 08:31
浏览 238


I have two pages (checkout and order page).
The checkout page contains a confirme order button. If the button is clicked the order page loads the data without a page refresh.

How can i do that. Please click me.

图片转代码服务由CSDN问答提供 功能建议

我有两个页面( checkout order 页面) 。 结帐页面包含确认订单按钮。 如果单击该按钮, order 页面将加载数据而不刷新页面。

我该怎么做。 请点击我。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongwei7245 2015-01-28 08:37

    You can use an ajax call to get HTML from 'data.php' (or wherever you are getting your data from) and print that HTML into a div in checkout page.

      url: "data.php"
    }).complete(function(result) {
      $( div ).html(result);

    Something similar to this.

    For more on Ajax -

    打赏 评论
  • dongxie1907 2015-01-28 09:06

    First take a simple button and call a jquery function onclick-

     echo '<a href="#" id="button">Click to change</a>';


    <script type="text/javascript">
    $(function() { // wrap inside the jquery ready() function
    //Attach an onclick handler 
    //Get the ID of the button that was clicked on (addition if you want any specific data, just pass that id in place of button)
    var specific_id = $(this).attr("id");
      url: "yourPHP_data.php", //This is the page where you will handle your SQL insert
      type: "POST",
      data: "data=" + specific_id, //The data your sending to yourPHP_data.php
      success: function(){
          console.log("AJAX request was successfull");
          console.log("AJAX request was a failure");

    yourPHP_data.php page contain your code that you want to load and display, and you also find that data you have passed-

    $data = $_POST['data'];
    打赏 评论

相关推荐 更多相似问题