I want an array of objects to be sent via post through ajax. Background story: a user selects a number of rooms, and those rooms should be booked in another file using php.
The array/objects is defined as:
var rooms = {};
rooms[rname] =
{
"rname": rname, // eg 1.27
"date": date, // eg 2013-04-24
"time": time, // eg 20:15
"duration": duration // eg 4
}
And the ajax call is made
$.ajax({
type: 'GET', //used get to see the parameters passed
url: 'book_room.php',
data: rooms
});
However, it seems that the request sent is somewhat like this:
How can I successfully pass a set of rooms in a request so I can work with them properly? I have a feeling that I have misunderstood the purpose of something here.