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

Source: Internet
Author: User
New Post continuation Q: $. ajax () function for how to use the return value of some details Reference 33 floor anyilaoliu reply:
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.


Reply to discussion (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.

1. what are you talking about? Where is the original post?
2. your original post does not clearly describe your requirements. anyilaoliu has the patience to illustrate the entire code.
If you are not satisfied with your intention, it is normal because you have not explained the details.
3. the skill industry is Specialized. js issues should be discussed on the javascript page.
This can also help you identify the tasks of the server and the client.

1. what are you talking about? Where is the original post?
2. your original post does not clearly describe your requirements. anyilaoliu has the patience to illustrate the entire code.
If you are not satisfied with your intention, it is normal because you have not explained the details.
3. the skill industry is Specialized. js issues should be discussed on the javascript page.
This can also help you identify the tasks of the server and the client.

After the post is closed, I do not know where the post is going.
Anyilaoliu and I have been discussing this in my previous post, so others in the new post may feel a little strange.

1. what are you talking about? Where is the original post?
2. your original post does not clearly describe your requirements. anyilaoliu has the patience to illustrate the entire code.
If you are not satisfied with your intention, it is normal because you have not explained the details.
3. the skill industry is Specialized. js issues should be discussed on the javascript page.
This can also help you identify the tasks of the server and the client.

Haha, it turns out that the moderator has returned to me.
I am a newbie. I want to know whether it is necessary to break the casserole. Otherwise, I will not do it without being ignorant.
It turns out that the sections are clearly divided. Speaking of this, I have knowledge limitations, and I am mainly engaged in Php, but I always encounter js problems.
Now that I have posted the post, I have to figure it out carefully and pay attention to it next time.
Thank you.

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.

First of all, thank you for your consistent support. Today, we have a little more headache. I'll try it in your way tomorrow, post the results and code, and try again. maybe it's just something to say, and you'll just give me some time.

Thanks again.

Don't be so polite... if you have any questions, just sort out and find out if you don't understand. csdn is a good platform. when I was a beginner, I was also enthusiastic experts who helped me through the difficult times...

It's too polite to feel the pressure ....

Just solve it.

Just solve it.

Under the guidance of anyilaoliu, the last three details in the post are handled satisfactorily. Thank you for your support. For some reason, I have not done the previously anticipated function of deleting records (the first problem in the post), so the results cannot be provided here for discussion.

I am a newbie and do not understand the rules here. I will discuss with anyilaoliu and the moderator here. I have a small question to ask, which is beyond the scope of the above four questions. if you should not ask in this post, you should open a new post. please remind me, then I will close the post immediately.

The main problem is very similar to the problem that anyilaoliu enthusiastically gave demon. so I want to ask, do you know?
The problem is actually very simple. a very simple page is divided into the upper and lower sections. The top part is divided into a select tag (the drop-down table contains several options for selection). each time you select an option in the drop-down table, you can search for the keyword value in the database, then display the result in the lower part of the page.

I think it should be done with a slight modification based on the demon code provided by anyilaoliu last time, but I have not done it yet, and it is bothering me for two days.

Tricky. please advise!






Just solve it.

Under the guidance of anyilaoliu, the last three details in the post are handled satisfactorily. Thank you for your support. For some reason, I have not done the previously anticipated function of deleting records (the first problem in the post), so the results cannot be provided here for discussion.

I am a newbie and do not understand the rules here. I will discuss with anyilaoliu and the moderator here. I have a small question to ask, which is beyond the scope of the above four questions. if you should not ask in this post, you should open a new post. please remind me, then I will close the post immediately.

The main problem is very similar to the problem that anyilaoliu enthusiastically gave demon. so I want to ask, do you know?
The problem is actually very simple. a very simple page is divided into the upper and lower sections. The top part is divided into a select tag (the drop-down table contains several options for selection). each time you select an option in the drop-down table, you can search for the keyword value in the database, then display the result in the lower part of the page.

I think it should be done with a slight modification based on the demon code provided by anyilaoliu last time, but I have not done it yet, and it is bothering me for two days.

Tricky. please advise!



If there is no problem, ask the moderator to remind you of the forum you should go to and hope you can find the answer faster.

What you are talking about now is no different from other functions implemented by ajax.

It can be split into the following functional points:

1. trigger a js function when selecting one of the drop-down menu items and pass the corresponding parameters
2. use ajax in js functions to submit the input parameters to the backend query results and return the results.
3. the returned results are displayed in ajax.

You have analyzed which link you have not completed.



Just solve it.

Under the guidance of anyilaoliu, the last three details in the post are handled satisfactorily. Thank you for your support. For some reason, I have not done the previously anticipated function of deleting records (the first problem in the post), so the results cannot be provided here for discussion.

I am a newbie and do not understand the rules here. I will discuss with anyilaoliu and the moderator here. I have a small question to ask, which is beyond the scope of the above four questions. if you should not ask in this post, you should open a new post. please remind me, then I will close the post immediately.

The main problem is very similar to the problem that anyilaoliu enthusiastically gave demon. so I want to ask, do you know?
The problem is actually very simple. a very simple page is divided into the upper and lower sections. The top part is divided into a select tag (the drop-down table contains several options for selection). each time you select an option in the drop-down table, you can search for the keyword value in the database, then display the result in the lower part of the page.

I think it should be done with a slight modification based on the demon code provided by anyilaoliu last time, but I have not done it yet, and it is bothering me for two days.

Tricky. please advise!



If there is no problem, ask the moderator to remind you of the forum you should go to and hope you can find the answer faster.

What you are talking about now is no different from other functions implemented by ajax.

It can be split into the following functional points:

1. trigger a js function when selecting one of the drop-down menu items and pass the corresponding parameters
2. use ajax in js functions to submit the input parameters to the backend query results and return the results.
3. the returned results are displayed in ajax.

You have analyzed which link you have not completed.


These three functions are very good. This logic is clear, and there should be no major problems with the last two questions. This is the first problem. Previously, based on your demon, the code is:

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.