javascript-php JS Interactive Data

Source: Internet
Author: User
$.get('/path/to/file', function(data) {        if(data){            //将数据塞到你的相应的dom节点中就OK了        }    /});

Want to ask: does this data need PHP return $data or Echo $data. I'm not trying to make ...

Reply content:

$.get('/path/to/file', function(data) {        if(data){            //将数据塞到你的相应的dom节点中就OK了        }    /});

Want to ask: does this data need PHP return $data or Echo $data. I'm not trying to make ...

Echo
1 General 3 formats json,text,xml output corresponding format data $.get (url,function (Result set object) {}, ' format ') according to your corresponding situation
2 feel you don't quite understand this principle. For example, how do you judge if he is a yellow website.
1 Access to Destination address
2 Server completes a series of business logic
3 Show it
4 Your eyes have seen and told your brain 5 you know what you're doing next.
Ajax Here's the data is your eyes, return is only the 2nd step, Echo is the 3rd step, only show your data object to see, then you can use the data

Return and Echo (Print_r, etc.) are all possible, but the order is to output the return data first, and then output the echo from top to bottom.

    $.get(url,function(data){    });

Do you have any questions about your URL?

To be able to return a string
Should use Echo

  • 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.