1
|
<script type= "text/javascript" src= "http://www.yiwuku.com/myService.aspx?jsonp=callbackFunction" ></script>
|
1
2
3
4
5
6
7
8
9
10
11
12
|
<script type= "text/javascript" >
function CustomerLoaded(result,methodName)
{
var html= '<ul>' ;
for ( var i=0;i<result.length;i++)
{
html+= '<li>' +result[i]+ '</li>' ;
}
html+= '</ul>' ;
document.getElementById( 'divCustomers' ).innerHTML=html;
}
</script>
|
1
|
< div id = "divCustomers" ></ div >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<title>Top Customers with Callback</title>
</head>
<body>
<div id= "divCustomers" >
</div>
<script type= "text/javascript" >
function onCustomerLoaded(result, methodName) {
var html = '<ul>' ;
for ( var i = 0; i < result.length; i++) {
html += '<li>' + result[i] + '</li>' ;
}
html += '</ul>' ;
document.getElementById( 'divCustomers' ).innerHTML = html;
}
</script>
<script type= "text/javascript" src= "http://www.yiwuku.com/myService.aspx?jsonp=onCustomerLoaded" ></script>
</body>
</html>
|
1
2
3
4
5
6
7
8
9
10
11
|
<script>
$(document).ready( function (){
$.getJSON( "http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?" ,
function (data){
$.each(data.items,
function (i,item){
$( "<img/>" ).attr( "src" ,item.media.m).appendTo( "#images" );
if (i==3)returnfalse;
});
});
});
|
1
2
3
4
5
6
7
8
9
|
$.ajax({
dataType: 'jsonp' ,
data: 'id=10' ,
jsonp: 'jsonp_callback' ,
success: function (){
//dostuff
},
});
|