Menu icon Foundation
problems with ajax

Hello Guys!

First I would like to apologize for the language, I'm with the help of Google Translator.

Foundation implemented the library on my site, everything is ok, all pages work normally. But I'm having trouble with a screen where I need to send an ajax post.

I have a "div" that will work the data and show the user, but the e'mostrada window but Ajax does not work. I'll summarize the code:

form:

<form accept-charset="UTF-8" action="questionario.php" method="get" data-remote="true" data-type="html" id="formId">
<input type="submit" id="my-submit" name="commit" data-reveal-id="resposta" class="large button alert radius" data-reveal-ajax="true" value="Responder" />
</form>
            

         

Area that will be shown the action:

<div id="resposta" class="reveal-modal" data-reveal>
  <h2>Aqui entra a programação para validar as respostas.</h2>
  <a class="close-reveal-modal">&#215;</a>
  
  <div id="respostas">
      aaa
  </div>
</div>
            

         

Source:

<script type="text/javascript">
// formId is the id of your form
$('#formId').submit(function (e) {
    var url = $(this).attr('action');
    alert(url);
    $.ajax({
        type: 'POST',
        url: url,
        data: $('#formId').serialize(),
        success: function (data) {
            $('#respostas').foundation('reveal', 'open')
        }
    });
    e.preventDefault();
});	
</script>
            

         

Could someone help me?

Thank you!

Regards,
Carlos

AJAXreveal

Hello Guys!

First I would like to apologize for the language, I'm with the help of Google Translator.

Foundation implemented the library on my site, everything is ok, all pages work normally. But I'm having trouble with a screen where I need to send an ajax post.

I have a "div" that will work the data and show the user, but the e'mostrada window but Ajax does not work. I'll summarize the code:

form:

<form accept-charset="UTF-8" action="questionario.php" method="get" data-remote="true" data-type="html" id="formId">
<input type="submit" id="my-submit" name="commit" data-reveal-id="resposta" class="large button alert radius" data-reveal-ajax="true" value="Responder" />
</form>
            

         

Area that will be shown the action:

<div id="resposta" class="reveal-modal" data-reveal>
  <h2>Aqui entra a programação para validar as respostas.</h2>
  <a class="close-reveal-modal">&#215;</a>
  
  <div id="respostas">
      aaa
  </div>
</div>
            

         

Source:

<script type="text/javascript">
// formId is the id of your form
$('#formId').submit(function (e) {
    var url = $(this).attr('action');
    alert(url);
    $.ajax({
        type: 'POST',
        url: url,
        data: $('#formId').serialize(),
        success: function (data) {
            $('#respostas').foundation('reveal', 'open')
        }
    });
    e.preventDefault();
});	
</script>
            

         

Could someone help me?

Thank you!

Regards,
Carlos