|
|
找來找去就是很難一搜就拿到JQuery Ajax好的sample code(官網DOC還是那麼讓人...)
- $.ajax({
- url: 'http://url',
- data: {"key":"value"},
- type:"POST",
- dataType:'json',
- success: function(msg){
- alert(msg);
- console.log(msg);
- },
- error:function(jqXHR, textStatus, errorThrown){
- alert(jqXHR.status);
- alert(errorThrown);
- }
- });
複製代碼 NOTE: data欄位可使用String送,後端如PHP則利用 file_get_contents("php://input"); 來接。 |
|