Hi I need to write an ajax function to reload the content in a div of my Free marker tool page
the Div contains a question with yes or no radio buttons and when the user picks yes and click the submit button the page should reload and as I am very new to ajax I wrote something like this PLEASE LET ME KNOW IF THE FORMAT I WROTE IN CREATING A VARIABLE IS RIGHT OR WRONG AND PLEASE LET ME KNOW IF I WROTE ANY SYNTAX ERRORS THANKS
<script type="text/javascript">
function submitOptIn() {
$('optInError').hide();
dataString = $('#partnerOptIn').serialize();
$.ajax({
data: dataString,
timeout: 30000,
type: "POST",
var newHtml = "<h4>Thank you</h4>
<p>We appreciate your time to respond to our request.</p>";
success: function(html){
$('#optInContent').html(newHtml);
},
success: function(html){
$('#optInContent').html(html);
},
error: function(){
$('#optInError').show();
}
});
}
</script>