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

Commit1d11ec6

Browse files
committed
Merge pull requestgithub#426 from jacobbednarz/fix-parsing-for-jsonp-callback-example
Update the parsing of JSON-P callback example
2 parents5a4611e +ad17e17 commit1d11ec6

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

‎content/v3.md‎

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -535,28 +535,27 @@ $ curl https://api.github.com?callback=foo
535535

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

538-
<pre><codeclass="language-html">&lt;html>
539-
&lt;head>
540-
&lt;script type="text/javascript">
541-
function foo(response) {
542-
var meta = response.meta
543-
var data = response.data
544-
console.log(meta)
545-
console.log(data)
546-
}
547-
548-
var script = document.createElement('script');
549-
script.src = 'https://api.github.com?callback=foo'
550-
551-
document.getElementsByTagName('head')[0].appendChild(script);
552-
&lt;/script>
553-
&lt;/head>
554-
555-
&lt;body>
556-
&lt;p>Open up your browser's console.&lt;/p>
557-
&lt;/body>
558-
559-
&lt;/html></code></pre>
538+
<html>
539+
<head>
540+
<script type="text/javascript">
541+
function foo(response) {
542+
var meta = response.meta;
543+
var data = response.data;
544+
console.log(meta);
545+
console.log(data);
546+
}
547+
548+
var script = document.createElement('script');
549+
script.src = 'https://api.github.com?callback=foo';
550+
551+
document.getElementsByTagName('head')[0].appendChild(script);
552+
</script>
553+
</head>
554+
555+
<body>
556+
<p>Open up your browser's console.</p>
557+
</body>
558+
</html>
560559

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp