Created
June 11, 2011 09:04
-
-
Save tokkonopapa/1020389 to your computer and use it in GitHub Desktop.
/echo/json/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /echo/json/ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="result"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
// jQuery.post() | |
$.post("/echo/json/", { | |
json: $.toJSON({ | |
"1st": "ヤクルト", | |
"2nd": "中日", | |
"3rd": "巨人" | |
}), | |
deley: 1 | |
}).success(function(data, textStatus, jqXHR) { | |
$("#result").append("<p>1st:" + data["1st"] + ", 2nd:" + data["2nd"] + ", 3rd:" + data["3rd"] + "</p>"); | |
}); | |
// jQuery.ajax() | |
$.ajax({ | |
type: 'POST', | |
dataType: "json", | |
url: "/echo/json/", | |
data: { | |
json: $.toJSON({ | |
"1st": "ソフトバンク", | |
"2nd": "日本ハム", | |
"3rd": "西武" | |
}), | |
deley: 3 | |
} | |
}).success(function(data, textStatus, jqXHR) { | |
$("#result").append("<p>1st:" + data["1st"] + ", 2nd:" + data["2nd"] + ", 3rd:" + data["3rd"] + "</p>"); | |
}); | |
// jQuery.getJSON() は GET のため、使用不可 | |
$.getJSON("/echo/json/", { | |
json: $.toJSON({ | |
"1st": "阪神", | |
"2nd": "ロッテ", | |
"3rd": "広島" | |
}), | |
deley: 5 | |
}).success(function(data, textStatus, jqXHR) { | |
$("#result").append("<p>1st:" + data["1st"] + ", 2nd:" + data["2nd"] + ", 3rd:" + data["3rd"] + "</p>"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: /echo/json/ | |
description: /echo/json のテスト | |
authors: | |
- tokkonopapa | |
resources: | |
- http://jquery-json.googlecode.com/files/jquery.json-2.2.js | |
- https://getfirebug.com/firebug-lite-debug.js | |
normalize_css: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment