Is there anyway you can submit a form using jquery? I have the following code which sends the id of a post when you scroll and was wondering if I could also submit some form values (ex, tv in this case) along with it.
Many thanks
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$('div#loadmoreajaxloader').show();
$.ajax({
url: "loadmore.php?lastid=" + $(".postitem:last").attr("id"),
success: function(html){
if (html) {
$("#postswrapper").append(html);
$('div#loadmoreajaxloader').hide();
} else {
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
});
}
});
The html for the form is as follows:
<select id="tv_dropdown" name="tv_dropdown" class="selecttv">
<option value="">any tv</option>
<option id="tv" value="Samsung">Samsung</option>
<option id="tv" value="Panasonic">Panasonic</option>
<option id="tv" value="Sony">Sony</option>
<option id="tv" value="Sharp">Sharp</option>
</select>
You can pass data in
dataoption ofajaxoptions. Try this