0

I have a problem with some functions. I am new with JQuery and I would like to know how I could solve this problem that does not work for me. In the script part I have:

$("#restar").click(function() {
  $.post("performsr.php", {
      u: $("#user").val(),
      a: 1
    })
    .done(function(data) {
       if(data == "1"){ location.reload(); } });
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<span id="restar">
<input type="hidden" id="user" value="Nick Name" /> - 
</span>

8
  • 1
    What are you expecting the code to do? Please explain the problem with more details.
    – theusaf
    Oct 16, 2019 at 0:36
  • I don't run the php as I want Oct 16, 2019 at 0:41
  • What do you expect the PHP to do exactly? What isn't working?
    – theusaf
    Oct 16, 2019 at 0:43
  • 1
    Welcome to Stack Overflow. Your question is a bit too vague at this point. It's not clear what specifically is not working. You have not presented a "problem" nor have you made it clear what should happen when it's working correctly, so no goal. Please review: How do I ask a good question? stackoverflow.com/help/how-to-ask It would also be good to take the Tour: stackoverflow.com/tour
    – Twisty
    Oct 16, 2019 at 0:50
  • 1
    as your console shows, there is a syntax error in your function. Kindly remove the last line and try again.. '})'; use some good editor to identify the open and close braces. Oct 16, 2019 at 4:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.