_ajax correlation based on jquery.history to solve the forward backward problem of Ajax

Source: Internet
Author: User
Tags eval

The following is a jquery.history solution to the forward and backward Ajax problem, please see below for details.

The premise of this article is based on the background, so here will not consider the problem of SEO. At the same time, based on the background of the management system, also do not need to be collected, so will not consider refreshing this kind of direct knocking on the site of the situation!!!

This is used in the HTML5 of the history.state to solve.

The internet has already had JS open source solution pushstate. Refer to Pjax

But this program is not suitable for my project (backstage project), especially the main method is a little insufficient.

I'm using jquery.history.js to refer to this history.js.

Look at the code below.

<! DOCTYPE html>
 
 

User name <input id= "Txtuser" type= "text"/> <br/>

User ID <input id= "txtid" type= "text"/> <br/>

Show Results

<div id= "Divtxtinfo" ><input id= "Txtinfo" type= "text"/></div> <br/> <a funname= " DisplayInfo "title=" Wxq "href=" javascript:void (0); "class=" Apjax "> Submit </a> <br/> log: <textarea id="  Log "style=" width:100%;height:400px "></textarea> </body> 

3 history.pushstate Add to history and modify address bar

4 when back, execute the method in History.Adapter.bind, first get the state parameter

5 Change the previous JS modified variables back to the original value, the previous modified HTML component value changes back to the original value, the modified HTML component of the HTML content revert to the original value,

6 re-execute the method that was previously executed, that is, the method saved in Callbackfunctions.

The above content for you to introduce based on jquery.history to solve the problem of Ajax forward backward, code knowledge to demonstrate the effect of the focus on the implementation of the basic principles. I hope this article can give you the benefit of the harvest, to learn more about jquery forward back to the relevant knowledge, please continue to pay attention to cloud Habitat community website.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.