Reputation: 215
I'm getting a json string back from a php request. I do this like this:
department = $("#department").val();
hospital = $("#hospital").val();
if (hospital = "Not entered") {
hospital = "Meander";
} else {
hospital = $("#hospital").val();
}
console.log('changed');
$.getJSON('functions/charts_hospital.php?hosp=' + hospital,
I also want to include department in this string after the hosp=' + hospital
like this: dept=' + department
. Is this possible and how do i do this?
Regards,
Bart
Upvotes: 0
Views: 24
Reputation: 622
Here you go: just add &
to concatenate two variables to pass as GET params.
$.getJSON(
'functions/charts_hospital.php?hosp='+hospital+'&dept='+department,
function(data){}
);
P.S.: equality operator is ==
. In your first if
you are setting hospital
to the value Not entered
.
Upvotes: 1