JSONP

Total Post:113

Points:791

 403  View(s)
Ratings:
Rate this:

What is Jsonp? Difference between Json and Jsonp ?

  1. Re: JSONP

    JSONP :

    JSONP means JSON with Padding. 

    JSONP does not use the XMLHttpRequest object.

    JSONP uses the <script> tag instead.

    Requesting an external script from another domain does not have this problem.

    JSONP uses this advantage, and request files using the script tag instead of the XMLHttpRequest object. 

    Syntax:

    <script src="demo_jsonp.php"> 


    Server File :

     <?php 
    $myJSON = '{ "name":"Prakash", "age":19, "city":"Allahabad" }';
    echo "myFunc(".$myJSON.");";
    ?>


    Callback Function:

    function clickButton() { 
        var s = document.createElement("script");
        s.src = "jsonp_demo_db.php?callback=myDisplayFunction";
        document.body.appendChild(s);
    }

  1. Re: JSONP

    thanks for this

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.