How to display data on a webpage after ajax is added

Source: Internet
Author: User

How to display data on a webpage after ajax is added

The following is illustrated in a text box. The details are as follows:

I am doing a project exercise this afternoon. I need to display the log query content on the webpage. At first, I got into a misunderstanding.

For a long time, I need to access ashx to generate html code for this small project. The Razor template engine is used in the background.

At the beginning, when the user list is displayed, it is displayed on another page (in fact, another page). razor can directly output data.

However, the following must be displayed below the current page.

When I submitted the code after ajax is spliced by the. razor template engine, the code is indeed returned to the data in ajax.

It cannot be shown like the figure above. My thoughts are shattered.
Then, I began to find a solution. now you need to return to the current page. you can directly submit a form. however, the form submission must be refreshed. A lot of code needs to be modified. I don't like it very much. give up. I think there is still a solution.

Create a page, but the buttons above will be gone, and the page will be invisible. How can I put the newly created page under this page? Using ifarme. It seems very troublesome.

Baidu...

Do not return the source code of the webpage. return data. Then write for loop binding.

But I still don't like it because I don't want to give up razor.

So I thought of innerHTML.

Directly change the html code of the element, use razor to replace the code, replace the code, and pass it to the ajax data. Then use innerHTML to assign a value, and then OK.

Html code to be replaced

Then write a <table id = "tb"> </table> in the page. use dom to obtain this element. var tb = document. getElementById ("tb"); then tb. innerHTML = the part of the preceding html code (returned using ajax );
 
So, OK. Does someone think This is troublesome? But I just want to use razor .........

Finally,

The above describes all the content displayed on the webpage for ajax query data. I hope it will be helpful to you.

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.