javascript - Can't get jQuery var to PHP -


i trying jquery var php can use mysql. have searched everywhere nothing seemed solve it.

i have following jquery code:

$('.eventrow').click(function(){      var eventid = this.id;      $.ajax(         {         url: "index.php",         type: "post",          data: { phpeventid: eventid},         success: function (result) {                 console.log('success');          }     });      $('#hiddenbox').html(eventid);     console.log(eventid);  }); 

if run this, id shown in both #hiddenbox , in console.log. console says "succes" ajax.

i trying in php file:

$value = $_post['phpeventid'];  echo "<div class = 'shownumber'>"."nummer: ".$value."</div>"; 

it says: nummer:

it gives no error whatsoever.

thanks help!

try

 var eventid = $(this).attr('id'); 

where id comes in code ?


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -