JSONP

Total Post:113

Points:791
 166  View(s)
Ratings:
Rate this:

What is Jsonp? Difference between Json and Jsonp ?

  1. Post:140

    Points:984
    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. Post:3

    Points:21
    Re: JSONP

    thanks for this

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!