New Post continuation question: some details about how to use the return value of the $. ajax () function

Source: Internet
Author: User
New Post resume: $. ajax () function references details about how to use the returned value & nbsp; 33 & nbsp; Lou & nbsp; anyilaoliu & nbsp; reply: You used to be the input border & nbsp; & nbsp; now you have replaced all input. There are two solutions & nbsp; first, you can directly insert the value into the new post of P. $. ajax () functions have some details about how to use the returned values.

Reference the reply from anyilaoliu on the 33rd floor:
You used to use the input border. now you have replaced the input.

There are two solutions. one is to directly insert a value into the input value.

Second, write the current statement and add a border to the td to make it look like the previous one.

The td.html (xxx) you wrote is not necessarily rigid. the content in your td will change accordingly.
--------------------------------------------------------------------------------
Anyilaoliu, a enthusiastic person, gave me guidance on my previous question. Afterwards, I raised some questions: (don't worry, I am a newbie. I want to answer the question in a down-to-earth manner. This makes it easy to solve these questions)

1. in the questions I asked earlier, I need to complete the record list on the left side of the page, and the detailed information of each field recorded on the right side (basically in the case of a box ), there is a save button to add records. Now I want to add a button to delete the selected record. My idea is: click a record on the left, and its content will appear on the right. click delete to delete the record. The difficulty I encountered in the implementation process is how to record the number of the selected record. the method I used was at $. ajax () points to ajax. in php. the PHP file uses the session method to record the number. Then, when you click the delete button, start another file, read the session, search for the database, and delete it. The program thinks that the session is not assigned a value. Dizzy, I tried to do something small before, and the session is the last retained trick, but it is not working now. I don't know how to do it?

2. insert the information returned from the file to the ajax. php specified in $. ajax (). For example

How should I perform this operation?

3. as mentioned in the previous post, anyilaoliu doesn't mean that the td.html (xxx) written to you must be rigid. the content in your td will change accordingly. "It means that not only td can be used, like

Can all be used like this, right? Is it okay to mark all the above types with class = "specified name?

4. also, $. $ (". show_tr "). text (..) return information, but there is $ in ajax. the post () function is written as $ ("# show_6 "). text (..), these two. show_6 and # show_6 cannot be mixed? I saw another friend who used $. post () everywhere. I want to know the advantages and disadvantages of these two functions and which one to use.

I am afraid this is a learning Post. thank you for your guidance.
Share:
------ Solution --------------------
I have mentioned a lot of things that may not be clearly described. maybe I can better understand some things by changing my host to someone else. I also hope that some people can point out what I'm saying is wrong.

1. I have never heard of deleting sessions. I decided to continue using ajax when I used ajax. This should be a habit. just like the one shown at a vertex, the unique field value corresponding to the vertex is transferred to the backend using ajax for deletion. a success mark is returned, when receiving this value in ajax success, the foreground refreshes the page or uses js to delete the corresponding dom node.

2. you can insert td into $ ("td" ).html (the value to be inserted). to insert the input in td, you can write $ ("td> input "). val (the value to be inserted) is nothing more than the selector. use various selectors to locate where you want to change the value

3. the selector problem still occurs. (let's continue with jquery's selector) for standard html tags,

You can use $ ("p") to select.

There is a class, such

You can use $ ("p. abc") or $ (". abc") to locate the p. If this p has an id
For example

You can use $ (". abc") or $ ("# bcd.
In short, regular labels are directly written in quotation marks, class is added, and id is added with #, which is the same as CSS selector rules $ ("p. abc ") indicates that the class is the p mark of abc, $ (". abc ") indicates any mark of the class as abc.

4. no matter $. ajax (), $. post (), or other jquery methods, all types of selectors can be used as long as they can be located according to the rules.
$. Ajax () and $. I don't know the difference between post () and I. The only difference I can see is $. ajax () can be set to get or post, and must be specified, while $. post () can only be used in the post mode, of course, you do not need to specify.


Correct.

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.