Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Update the parsing of JSON-P callback example#426

Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletionscontent/v3.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -535,28 +535,27 @@ $ curl https://api.github.com?callback=foo

You can write a JavaScript handler to process the callback. Here's a minimal example you can try out:

<pre><code class="language-html">&lt;html>
&lt;head>
&lt;script type="text/javascript">
function foo(response) {
var meta = response.meta
var data = response.data
console.log(meta)
console.log(data)
}

var script = document.createElement('script');
script.src = 'https://api.github.com?callback=foo'

document.getElementsByTagName('head')[0].appendChild(script);
&lt;/script>
&lt;/head>

&lt;body>
&lt;p>Open up your browser's console.&lt;/p>
&lt;/body>

&lt;/html></code></pre>
<html>
<head>
<script type="text/javascript">
function foo(response) {
var meta = response.meta;
var data = response.data;
console.log(meta);
console.log(data);
}

var script = document.createElement('script');
script.src = 'https://api.github.com?callback=foo';

document.getElementsByTagName('head')[0].appendChild(script);
</script>
</head>

<body>
<p>Open up your browser's console.</p>
</body>
</html>

All of the headers are the same String value as the HTTP Headers with one
notable exception: Link. Link headers are pre-parsed for you and come
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp