Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. $(document).ready(function(){ // I've refrained from adding additional code above, but this where the trouble starts
  2. $.post('php/validate_input2.php', { nm : nm, lnm : lnm, em : em, um : um, jh : jh, us : us, cb : cb}, function(data, status)
  3. {
  4. if(status === "success")// it will enter this code block without fault
  5. {
  6. if(data == "failed_insert" || data == "revise_input")// heed the comparison operators. I've tried === too but to no avail. jQuery will ignore this block of code even when I know the data echo'd is either 1.
  7. {
  8. if(data == "failed_insert")// as above with === I've tried it
  9. {
  10. alert("Server technical issues: " + data + " " + status); // I've left out all the fancy jQ magic for now if "failed_insert", but for testing I want to see this response here "as is".
  11.  
  12. }
  13. else
  14. {
  15. alert("Fields have failed validation: " + data + " " + status); // I don't see this code block getting executed neither
  16.  
  17. }
  18. }
  19. else
  20. {
  21. alert("Data has been inserted: " + data + " " + status); // this is where EVERYTHING gets executed. This should only be shown if its not "revise_input" || "failed_insert" but one of various messages upon success of insert.
  22. }
  23. }
  24. else
  25. {
  26. alert("Failed or other data response; irrelevant for now");//as the alert suggests, no issue here.
  27. }
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement