JavaScript onsubmit not executing JavaScript function onsubmit call javascript function,onsubmit run javascript function,onsubmit call

Change the name of the function nbpost so it does not match the textarea id='nbpost'

CodePen

Answer:1

I would try and separate your content a little better, it can make it less confusing. Give this a try with jQuery enabled.

<?php
      if(isset($_SESSION['user'])) {
          $usr = $_SESSION['user']; ?>
          <form id="form" method="post">
          <textarea id='nbpost' placeholder='Create a post...'></textarea>
          <input type="hidden" name="user" value="<?=$usr;?>">
          <button type='submit'>SUBMIT</button>
          </form>
          <?php
      }
?>

This needs to go at the bottom of your document. You can also put the JavaScript in a separate file and call it by filename of course.

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$("#form").on("submit", function (e) {
  e.preventDefault();
  var name = $("input[name=user]").val().toUpperCase();
  var msg = $("#nbpost").val();
  console.log(name, msg);

  $.ajax({
    url: "http://rmpc/php/nbpost.php",
    method: "POST",
    data: {
      name: name,
      notice: msg
    }
  });
});

</script>

see if this works for you.

Answer:2

I have used more effects.The effects likes based on the drag the scroll in browser or going to down of the page in my home page. I have implemented the top button, it can goes top of the page. When i ...

I have used more effects.The effects likes based on the drag the scroll in browser or going to down of the page in my home page. I have implemented the top button, it can goes top of the page. When i ...

I am new to React and I try to build a timer component. Now I have the start function working but I would also like to stop the timer by an onclick handler. The problem is that the start function uses ...

I am new to React and I try to build a timer component. Now I have the start function working but I would also like to stop the timer by an onclick handler. The problem is that the start function uses ...

  1. stop interval in javascript
  2. stop interval in js
  3. stop interval in angularjs
  4. stop interval in jquery
  5. setinterval react native
  6. stop interval in angular
  7. setinterval on click
  8. stop interval in function
  9. typescript setinterval
  10. angular 6 stop interval
  11. stop interval in function javascript
  12. js stop interval from inside

I have an issue with tooltip in Highcharts column charts. When series fill my chart, the tooltip is under the serie. But he is cut by then end of div, as you can see here : What should I do to make ...

I have an issue with tooltip in Highcharts column charts. When series fill my chart, the tooltip is under the serie. But he is cut by then end of div, as you can see here : What should I do to make ...

  1. dynamic position tooltip javascript
  2. dynamic position tooltip jquery
  3. dynamic position tooltip
  4. css dynamic tooltip position

I need to take a JSON object and get the titles console logged for an auto complete feature. AN example of what my json looks like is below: [ { "title": "Example 1", "url": "http:\/\/www....

I need to take a JSON object and get the titles console logged for an auto complete feature. AN example of what my json looks like is below: [ { "title": "Example 1", "url": "http:\/\/www....

  1. json parsing error redshift
  2. json parsing error 8001
  3. json parsing error in row starting at position
  4. json parsing error no value for
  5. json parsing error android
  6. json parsing error
  7. json_parsing_error unexpected character (t) at position 0
  8. json_parsing_error unexpected character (-) at position 0
  9. json parsing error value
  10. json parsing error python
  11. json parsing error paladins
  12. json_parsing_error unexpected token end of file at position
  13. json parsing error unexpected token expected
  14. json_parsing_error unexpected token end of file
  15. json parsing error unexpected token
  16. json parsing error fcm
  17. json parse error unexpected eof
  18. json parse error cannot construct instance of
  19. json parse error cannot deserialize instance of
  20. json parse error unexpected identifier object