I have a VF page with very few input HTML tags and I want to pass these values to the controller via javascript remoting on a click of Submit. I see that my submit function is being called but for some reason the method on the controller is not called. I went over and over but the code seems to be fine. This is what I wrote, do you see any issue?
My Controller method:
global with sharing class ReservationController {
@RemoteAction
global static boolean Submit(string FName, string LName, string Email, string Phone,
string Company, string Website){
system.debug('in submit');
}
}
My javascript:
<script type="text/javascript">
$(document).ready(function(){
$('#form1').submit(function(){
var ok = true;
...some code...
if(ok){
//submit
console.log("form ok");
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.ReservationController.Submit}',
$('#firstName').val(), $('#lastName').val(), $('#theEmail').val(),
$('#thePhone').val(), $('#theCompany').val(), $('#theWebsite').val(),
function handleResult(result, event) { alert(result); },
{escape: true}
);
}
else{
console.log("form not ok");
return false;
}
});
});
submit
method name to something else. I've had issues in the past using common names for the methods.