jquery ajax click passes a number to a php file. Need jquery to pass a text response -


i getting response, number. how can actual text name?

echo "<td><a href='#' class='js-load-more' data-playername='" .($players['first_name'])."'>".($players['first_name'])." ". ($players['last_name'])."</a></td>";  $(document).ready(function () {     $(".js-load-more").click(function () {         var name = $(this).data('playername');         $.ajax({             url: '/test2.php',             type: 'get',             cache: 'false',             data: 'name',             success: function (data) {                 $('#info').html(data);             },         });     }); }); 

returns number "1". why not name?:

<?php   $test = isset($_get['name']);   echo $test; ?> 

because isset() returns boolean value.

isset($_get['name']); // returns true or false  $_get['name']; // returns playername or undefined index 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -