JSONP using the principle of the src attribute and background with cross-domain

JSONP principle

html page:

<script>

  function getData(data){

    console.log(data);

}

</script>

<script src = "cross-domain address? callback = getData ">

PHP page:

<?php

  echo $ _GET [ "callback"] '(data.)';

?>

Guess you like

Origin www.cnblogs.com/zhouzhiqin/p/12119708.html