jquery-How to replace the values in a page element with $.get (getdata.php,data,success, "json") to get the data in the database.

Source: Internet
Author: User
How to replace the values in a page element with $.get (getdata.php,data,success, "json") to get the data in the database. Please tell me more about your ideas.

Reply content:

How to replace the values in a page element with $.get (getdata.php,data,success, "json") to get the data in the database. Please tell me more about your ideas.

To modify a node by using the Success function

Assume that you get an article content, and that the page appears in the DIV with the ID content.

1.html

2. Return JSON format data in getdata.php

{    "code": 0,    "data": "视频中,渔夫们在得意地炫..."}

3.js Ajax Get Data rendering page

    $.get("/getdata.php", data, function(response) {        var data = response.data;        $("#content").html(data);    }, "json");
  • 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.