I’m using jQuery’s post on a WordPress page.
var thename = jQuery("input#name").val();
jQuery.post(the_ajax_script.ajaxurl, jQuery("#theForm").serialize(),
function(response_from_the_action_function){
jQuery("#response_area").html(response_from_the_action_function);
});
It posts the selections made in a form. Is it possible to append data to a post. So in addition to the form data, I need a couple lat longs added to the jQuery post. How can I do that. Is it possible?
Thnak you.
-Laxmidi
.post()takes a string as the second argument, so you can concatenate a custom string using+followed by your string.Do be careful, though; the string has to be correctly formatted as a URL, so you need
key=valuepairs separated by&s.In the example above, you’ll see
+ "&foo=bar. The first&finishes the last value created by.serialize(), thenfoo=is a key, followed bybaras the value.If you want to add more values afterwards, you can do something like this: