Answer the question
In order to leave comments, you need to log in
Cross-domain data exchange and jsonp when creating a plugin for Cchrome, how to implement?
I decided to write a plugin for chrome that will display the number of unwatched TV shows on the sizonvar. And I ran into a security policy ... But I successfully dealt with this problem using jsonp.
$.ajax({
url: "http://seasonvar.ru/jsonMark.php",
jsonp: "callback",
dataType: "jsonp",
success: function( response ) {
if(response.data.today == undefined)
alert(1)
else
alert(2);
}
});
Answer the question
In order to leave comments, you need to log in
Here is your option:
background.html
<!doctype html>
<html>
<head>
<title></title>
<script type="text/javaSCRIPT" src="js/jquery-1.11.2.min.js"></script>
<script type="text/javaSCRIPT" src="js/background.js"></script>
</head>
<body></body>
</html>
$.ajax
({
url: "http://seasonvar.ru/jsonMark.php",
dataType: "json",
success: function( response )
{
console.log('old: ' + response.data.old);
console.log('noSeries: ' + response.data.noSeries);
}
});
"background" :
{
"page": "background.html"
},
"permissions":
[
"http://seasonvar.ru/*",
"tabs"
],
"content_security_policy":
"script-src 'self' 'unsafe-eval'; object-src 'self'"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question