I'm trying to send data from option selector
<select id="city">
<option value="{'city':'melbourne','lat':'-37.8602828','long':'144.9631'}">Melbourne</option>
Through an AJAX POST
$.ajax({
method: "POST",
url: "action.php",
dataType: "json",
data: {
city: $('#city option:selected').val()
},
})
However I got an empty $_POST
in action.php
. What is the correct way to send the value of the selected option through an AJAX request?