1

Hi can anyone help me on this issue, please post whole code because i am really a noob in coding and allready lost many hours searching for the right answer. If i want to vote for this game see "spielbewertung" on this page http://www.spielonline.ch/spiel.php/Kogama-Ostry.html the page loads the iframe nickolodeonspelheader.php from the page spiel.php after voting and the url looks like this http://www.spielonline.ch/nickelodeonspelheader.php/Kogama-Ostry.html which offcourse is wrong it should change the data in the database after input and come back on the original parent page so the game can be played after voting. This is the form code:

<table style="display: inline-block;"><tr>

<td class="top" colspan="1" width="100%"><h2>Spielbewertung</h2></td></tr>
    <tr><td width="50%" style="align:left;">
    <form name="rating" action="" method="post">
      <p style="font-family: tahoma; font-size: x-small;">
        <b>Spiel bewerten:</b>
                     <select name="number">
                      <option value="">-</option>
        <option value="3">3 = sehr schlecht</option>
        <option value="4">4 = mangelhaft</option> 
        <option value="5">5 = langweilig</option>
        <option value="6">6 = ausreichend</option>
        <option value="7">7 = befriedigend</option>
        <option value="8">8 = gut</option>
        <option value="9">9 = sehr gut</option>
        <option value="10">10 = hervorragend</option>
        </select>
        <input type="submit" name="vote" value="bewerten" style="cursor: pointer" />        
                              </p>
                 </form>

    </td></tr>
</table>

Many thanks for help in advance!

Jacob Vendrig
  • 11
  • 1
  • 1
  • 4
  • a redirect keeps loading the page over and over again or i must done something wrong, give me the right redirect code if you will. – Jacob Vendrig Apr 14 '17 at 16:22

1 Answers1

0

Maybe you can use suggestion from this post: callback when form submitted using submit() method And replace alert("done") with location.reload();

For example:

<!-- Import jQuery in your <head> tag -->

<head>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>

<body>
<!-- your html source -->

<table style="display: inline-block;"><tr>

<td class="top" colspan="1" width="100%"><h2>Spielbewertung</h2></td></tr>
    <tr><td width="50%" style="align:left;">

<!-- Add id attribute for form -->

    <form id="submit-form" name="rating" action="" method="post">
  <p style="font-family: tahoma; font-size: x-small;">
    <b>Spiel bewerten:</b>
                 <select name="number">
                  <option value="">-</option>
    <option value="3">3 = sehr schlecht</option>
    <option value="4">4 = mangelhaft</option> 
    <option value="5">5 = langweilig</option>
    <option value="6">6 = ausreichend</option>
    <option value="7">7 = befriedigend</option>
    <option value="8">8 = gut</option>
    <option value="9">9 = sehr gut</option>
    <option value="10">10 = hervorragend</option>
    </select>
    <input type="submit" name="vote" value="bewerten" style="cursor: pointer" />        
                          </p>
             </form>

</td></tr>

<script>
$form = $("#submit-form"); 
$form.on("submit",function()
{
   alert("submitting..");
   //do ajax
   $.ajax({
       url:<submit url>,
       type:post,
       success:function() {
           location.reload();
       }
   });
});
$form.submit();
</script>

</body>
Community
  • 1
  • 1
Linherest
  • 11
  • 4