Wednesday, 18 September 2013

Data sent to server using jquery get not requiring stings to be declared in quotations?

Data sent to server using jquery get not requiring stings to be declared
in quotations?

When using Jquery's get function I found a code snippet which I have
implemented in which data is sent to the server. the data is given to the
get function as a dictionary. In this dictionary the keys act as strings
yet are not wrapped in quotations. The values in this dictionary are
wrapped as strings. Can anyone explain what the difference is? the
variable name and time are NOT defined anywhere previously in the script.
Included is the entire script below.
<script>
$(document).ready(function () {
$.ajaxSetup({ cache: false });
$('button').click(function () {
$.get('query.php',{ name: "John", time: "2pm" },function (data) {
alert(data);
});
});
});
</script>

No comments:

Post a Comment