Use js to call the output of the ASPX page in ASP. NET

Source: Internet
Author: User

In actual development, if a news system needs to use js to call news of a certain category.

Non-codebehind version
Showjs. aspx
----------------------------
<% Response. Write ("document. Write ('output')") %>
Showjs.html
---------------------------
<Script language = "JavaScript" src = "showjs. aspx"> </SCRIPT>
In this example, the "output" can be output by using showjs.html"

Codebehind
Use vs. Net to create showjs. aspx and then add the htmlCodeDelete all
<% @ Page Language = "C #" codebehind = "showjs. aspx. cs" autoeventwireup = "false" inherits = "hover. showjs" %>
Then in the page_load () file in showjs. aspx. CS
Response. Write ("document. Write ('output ')");
In this way, the output is normal.
If you call showjs. aspx in showjs.html, a script error is reported.
Because when you view the HTML code of the showjs. aspx runtime, you understand that the output is not only document. Write ('output ')
The HTML code of the default document including aspx cannot be called!
Thanks for your advice. It is really most valuable professional. That enthusiasm is enough for learning. I hope I don't bother him. Oh! This problem is easy for me to understand. Ah

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.