Skip to content

Instantly share code, notes, and snippets.

@jalalhejazi
Created March 3, 2014 13:27
Show Gist options
  • Select an option

  • Save jalalhejazi/9324905 to your computer and use it in GitHub Desktop.

Select an option

Save jalalhejazi/9324905 to your computer and use it in GitHub Desktop.
Kasper: CORS med JSONP
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ajax with JSONP</title>
</head>
<body>
<section data-til="Kasper">
Dette er eksempel på ajax with padding (jsonP). <br>
en løsning til CORS som også gælder legacy browsere <br>
Men, med det rette request så kan man bypass browser sikkerhed som er vist. <br>
Efer min mening, så er denne løsning lige til .... <br>
<hr>
</section>
<h2 id="results"></h2>
<br>
<img src="info.png" alt="">
<script>
// hvem kalder denne function?
// URL Request med callback som parameter
MinClientSideFunktion = function(data){
console.dir(data)
$('#results').html(data.kursusOversigts[0].productTitle)
}
</script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://webapi.supermobile.dk/KursusOversigt/?ProductNumber=SU0095&format=json&callback=MinClientSideFunktion"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment