jQuery stopped working with PHP -


i have written code jquery session, etc. happens when click text link should come "success"

but when there's no data works, when put in data , fix it, code stops working completely.

 $(function() {     $(".open").click(function() {         var status = "open";         var ticketid = "<?php echo $_get['id']; ?>";         var username = "<?php echo $_session['mm_username']; ?>";         var datastring = 'status=' + status + 'id=' + ticketid + 'username=' + username;          if(status==='' || ticketid==='' || username==='' || datastring==='') {             $('.success').fadeout(200).hide();             $('.error').fadeout(200).show();         } else {             $.ajax({                 type: "post",                 url: "core/ticketdata.php",                 data: datastring,                 success: function(result){                      $('.success').fadein(200).show();                      $('.error').fadeout(200).hide();                 }                 });         }     return false;     }); }); 

this view source

     $(function() {     $(".open").click(function() {         var status = "open";         var datastring = 'status='+status;          if(status==='') {             $('.success').fadeout(200).hide();             $('.error').fadeout(200).show();         } else {             $.ajax({                 type: "post",                 url: "core/ticketdata.php?id=772&username=nomansland",                 data: datastring,                 success: function(result){                      $('.success').fadein(200).show();                      $('.error').fadeout(200).hide();                 }                 });         }     return false;     }); }); 

but when php empty works completely, when it's there stops. have tried echo & print.

any ideas?

updated

ok have worked on this, alerts work when you: click it, check variables, go through else, when hit $.ajax({ wont alert.

     <script>  $(function() {     $(".open").click(function() {         var status = "open";         var ticketid = "<?php echo $_get['id']; ?>";         var username = "<?php echo $_session['mm_username']; ?>";         var datastring = 'status=' + status + '&id=' + ticketid + '&username=' + username;          if(status==='' || ticketid==='' || username==='' || datastring==='') {             $('.success').fadeout(200).hide();             $('.error').fadeout(200).show();         } else {              datastring = {                'status' =  status,                'id' =  ticketid                'username' =  username         };              $.ajax({                 type: "post",                 url: "core/ticketdata.php",                 data: datastring,                 success: function(result){                      $('.success').fadein(200).show();                      $('.error').fadeout(200).hide();                 }                 });         }     return false;     }); }); 

updated

removed site, issue has been resolved.

you aren't concatenating correctly, missing &s in data, , that's why fails:

datastring = 'status=' + status + '&id=' + ticketid + '&username=' + username; //---------------------------------^-------------------^ 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -