I'm working on the codeigniter web application I need to get users' data from the database but based on user id?
The problem is that ajax
posting value to the index page browsers, network showing that Ajax posting value to the index page, When I try to echo or print variable on the index page.
Index Page Showing Error After Echo leadID
Notice: Undefined index: leadID and leadID = 0
Index Page
$addnote ="<a class='btn' data-popup-open='popup-1' href='#'
data-id='$lead->id'>Add Note</a>";
Ajax Posting
$('.btn').on('click', function(e) {
var targeted_popup_class = jQuery(this).attr('data-popup-open');
$('[data-popup="' + targeted_popup_class + '"]').fadeIn(350);
var leadID = $(this).attr('data-id');
var dataString = 'leadID=' + leadID;
$.ajax({
type: "POST",
dataType: 'text',
url: "index.php",
data: dataString,
success: function(response) {
}
});
});
Database Query
$leadID = intval($_POST['leadID']);
$sql = "select Note from {$dbPre}users where leadID='$leadID'";
$exists = $db->extQueryRowObj($sql);
$displaynote = $exists->Note;