i want to submit input with id='o' with jquery so when I click the Submit button nothing happens

Asked

Viewed 34 times

0

<form id="postnoticastoinvetors" name="postnoticastoinvetors" method="post" action=""> 
                        <div id="textopostagora" contentEditable="true" data-text="Publish Your news" spellcheck="true" aria-multiline="true"  style="text-align:center;color:grey;line-weight:18px;margin-left:1%;margin-top:3%;margin-bottom:3%;width:98%;word-wrap:break-word;outline:none;margin-bottom:3%;" ></div>
                        <div id="welcome" style="display:none;z-index:1000;min-width:4%;min-height:3%;max-height:480px;top:25%;left:4%;position:relative;margin-bottom:20px;">
                  <img id="imagemn" src="" title="" style="max-width:92%;max-height:320px;border-radius:5px;"/><br>
                            <input type="file" id="arquivo" name="arquivo" />   

                            <input type='hidden' name='o' id='o' value='1'/>
                        </div>
                            <div id="mes" class="mes" style="font-size:300px;"></div>
                        <hr id="hr" style="position:relative;"/>
                            <label id="label" title="Upload Images to Your Post" for="arquivo" style="opacity:0.5;z-index:10000;left:2%;position:relative;top:22%;width:5px;height:18px;text-align:center;" class="label">
                     <img id="camara" style="padding:2px;border-radius:2px;background:white;position:absolute;width:60%;height:80%;top:0%;left:10%;" src="http://empire-hq--nunoormaker21632223.codeanyapp.com/Signup/camara.ico" title="Upload Your Profile Image"/>
                  </label>
                <label id="label22" title="Adiciona Emojis ao teu post" onclick="addemojis()" style="display:block;opacity:0.5;z-index:10000;left:14%;position:relative;top:0%;width:5px;height:18px;text-align:center;margin-top:-8.1%;" class="label"><img id="camara" style="padding:2px;border-radius:2px;background:white;position:absolute;width:60%;height:80%;top:0%;left:10%;" src="http://empire-hq--nunoormaker21632223.codeanyapp.com/Investor/em.png" title="Add an Emoji"/></label>
              <label id="label23" title="Upload Images to Your Post" onclick="remoji()" style="display:none;opacity:0.5;z-index:10000;left:14%;position:relative;top:0%;width:5px;height:18px;text-align:center;margin-top:-8.1%;" class="label"><img id="camara" style="padding:2px;border-radius:2px;background:white;position:absolute;width:60%;height:80%;top:0%;left:10%;" src="http://empire-hq--nunoormaker21632223.codeanyapp.com/Investor/em.png" title="Add an Emoji"/></label>
                <div id="displayemojis" style="display:none;">
                    <label onclick="adde()" >&#x1F600</label> 
                             &#x1F601 &#x1F602 &#x1F603 &#x1F604 &#x1F605 &#x1F606 &#x1F607 &#x1F608 &#x1F609 &#x1F610 &#x1F611
                 &#x1F612 &#x1F613 &#x1F614 &#x1F615 &#x1F616 &#x1F617 &#x1F618 &#x1F619 &#x1F620 &#x1F621 &#x1F622 &#x1F623
                 &#x1F624 &#x1F625 &#x1F626 &#x1F627 &#x1F628 &#x1F629 &#x1F630 &#x1F631 &#x1F632 &#x1F633 &#x1F634 &#x1F635
                 &#x1F636 &#x1F637 &#x1F638 &#x1F639 &#x1F640 &#x1F641 &#x1F642 &#x1F643 &#x1F644 &#x1F645 &#x1F646 &#x1F647
                 &#x1F648 &#x1F649 &#x1F650 &#x1F651 &#x1F652 &#x1F653 &#x1F654 &#x1F655 &#x1F656 &#x1F657 &#x1F658 &#x1F659
                 &#x1F660 &#x1F661 &#x1F662 &#x1F663 &#x1F664 &#x1F665 &#x1F666 &#x1F667 &#x1F668 &#x1F669
                </div>
                        <button type="submit" name="insert" id="insert" style="position:relative;left:80%;margin-top:0px;font-size:14px;font-family:Stencil, Helvetica;color:white;border:2px;background: #1d8fff;width:90px;height:25px;cursor:pointer;vertical-align: middle;border: 2px solid white;border-radius: 2%;margin-bottom:5px;outline:none;" class="botao98990020000189088yk8kkk8987698888kky8rf">hjgkjton</button>
                    <br></form>
          <script>


                         jQuery(document).ready(function(){
                        jQuery('#postnoticastoinvetors').submit(function(){
                        var dados = jQuery(this).serialize();

                        jQuery.ajax({
                            type: "POST",
                            url: "http://empire-hq--nunoormaker21632223.codeanyapp.com/Investor/signpostmeufrontal.php",
                            data: dados,
                            success: function(strMessage){
                            $('#mes').append(strMessage);

                          }

                        });

                          return false;
                        });
                    }); 
             </script>
  • In the action="" you have to put the page that will receive the data.

  • but I want to do without Reload, that is, with jquery and if I put the page in the action jquery does not work

  • Then remove the attribute action tag form.

  • I have done with the action tag without any value only that now does not execute

  • and I’ve tried to take it out

  • ok! to action You must call Ajax.

  • Something like action="return funcao-do-ajax".

  • You must place Ajax inside a function that will be called when the form is submitted. Another thing, since the data will be loaded via Ajax, do not need to put the attribute method="post" in the form.

  • already worked thanks

  • I withdrew the post method and executed

  • Ah, cool! Good luck!

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.