Hi, I want to access a web service and get the response in json using javascript.
The web services can respond in json and gives me a table of records with a specific campus.
I input the campus code in the text box and create the url.
Now, I want to get the response in json and I'm really stuck.
Can anybody give me some clues please?
<FORM NAME="myform" ACTION="" METHOD="GET">Enter something in the box: <BR>
<INPUT TYPE="text" NAME="inputbox" VALUE=""><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="loadurl(this.form)">
</FORM>
<script>
function getData(form) {
var baseUrl = "https://studentwebservices/rest/location/campus/";
var campus = form.inputbox.value;
var url = baseUrl + campus;
// Code to be added
</script>
From the information search process:
I know I have to change the HTTP Header accept and use application/json
and probably use JSONRequest.get()
This is my very first post on a forum.