I have this code:
$(document).on('submit','#roomsend',function(e) {
var form = $('#roomsend');
var data = form.serialize();
$.post('php/roomlist.php', data, function(response) {
console.log(response);
$('#power').replaceWith(response);
});
return false;
});
This works with a Submit button inside the form. But now I have a button outside the form:
<button class="btn btn-success" id="roomsendbutton"><i class="icon-ok"></i> Save</button>
How must I must be the code, that when i clicked the button the button all actions will be work and the form submits?