Skip to content

Instantly share code, notes, and snippets.

@Mutale85
Created August 21, 2020 08:23
Show Gist options
  • Save Mutale85/a4accd7af45236433f46c85aba586bdc to your computer and use it in GitHub Desktop.
Save Mutale85/a4accd7af45236433f46c85aba586bdc to your computer and use it in GitHub Desktop.
Having issues with CORS?
This is how i manage to solve my CORS
$.ajax({
type: 'GET',
url: 'https://example.com/filename.php',
data:{postname:postname, postname2:postname2},
dataType: 'jsonp',
crossDomain: true,
success:function(data){
// console.log(data);
}
})
When you go into your filename.php
if(issest($_GET['callback'])){
$postname = $_GET['postname'];
$postname2 = $_GET['postname2'];
// Then do what you want with the information collected.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment