Created
June 5, 2011 19:00
-
-
Save jansabbe/1009277 to your computer and use it in GitHub Desktop.
Example calling json webservice with jQuery
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
var jsonData = JSON.stringify({ | |
stad: 'Leuven', | |
soort: 'KLEI', | |
telefoonNummer: '141414' | |
}); | |
$.ajax('/plaatsen', { | |
success:function (data) {console.log(data)}, | |
type: 'PUT', | |
dataType: 'json', | |
data: jsonData | |
}); | |
$.ajax('/plaatsen', { | |
success:function (data) {console.table(data)}, | |
type: 'GET' | |
}); | |
$.ajax('/plaatsen/1', { | |
success:function (data) {console.log(data)}, | |
type: 'GET' | |
}); | |
$.ajax('/plaatsen/1/metingen', { | |
success:function (data) {console.table(data)}, | |
type: 'GET' | |
}); | |
var jsonData = JSON.stringify({ | |
datum: new Date(), | |
longitude: '42', | |
latitude: '4', | |
phWaarde: 8, | |
commentaar: 'geen commentaar' | |
}); | |
$.ajax('/plaatsen/1/metingen', { | |
success:function (data) {console.log(data)}, | |
type: 'PUT', | |
dataType: 'json', | |
data: jsonData | |
}); | |
$.ajax('/plaatsen/1/metingen', { | |
success:function (data) {console.table(data)}, | |
type: 'GET' | |
}); | |
$.ajax('/plaatsen/1/metingen/1', { | |
success:function (data) {console.log(data)}, | |
type: 'GET' | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment