typeahead bootstrap selected value post
up vote
0
down vote
favorite
I am using bootstrap typeahead to suggest values from database for a form field. Here is the type ahead code.
$(document).ready(function()
$('#client_id').typeahead(
source: function(query, result)
$.ajax(
url:'client_search.php?extraParams=<?php echo $merchant_id;?>&',
method:"GET",
data:query:query,
dataType:"json",
success:function(data)
console.log(data);
result($.map(data, function(item)
return item;
));
)
)
);
The client_search.php file returns two values in json format -
$clientdata = array();
if($query->num_rows > 0)
while($row = $query->fetch_assoc())
$json['id'] = $row['id'];
$json['name'] = $row['name'];
array_push($clientdata, $data);
// Return results as json encoded array
echo json_encode($json);
Everything is working fine except that on form submit i want to post the ID field of the client instead of name.
Any help appreciated :)
twitter-bootstrap autocomplete typeahead
add a comment |
up vote
0
down vote
favorite
I am using bootstrap typeahead to suggest values from database for a form field. Here is the type ahead code.
$(document).ready(function()
$('#client_id').typeahead(
source: function(query, result)
$.ajax(
url:'client_search.php?extraParams=<?php echo $merchant_id;?>&',
method:"GET",
data:query:query,
dataType:"json",
success:function(data)
console.log(data);
result($.map(data, function(item)
return item;
));
)
)
);
The client_search.php file returns two values in json format -
$clientdata = array();
if($query->num_rows > 0)
while($row = $query->fetch_assoc())
$json['id'] = $row['id'];
$json['name'] = $row['name'];
array_push($clientdata, $data);
// Return results as json encoded array
echo json_encode($json);
Everything is working fine except that on form submit i want to post the ID field of the client instead of name.
Any help appreciated :)
twitter-bootstrap autocomplete typeahead
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using bootstrap typeahead to suggest values from database for a form field. Here is the type ahead code.
$(document).ready(function()
$('#client_id').typeahead(
source: function(query, result)
$.ajax(
url:'client_search.php?extraParams=<?php echo $merchant_id;?>&',
method:"GET",
data:query:query,
dataType:"json",
success:function(data)
console.log(data);
result($.map(data, function(item)
return item;
));
)
)
);
The client_search.php file returns two values in json format -
$clientdata = array();
if($query->num_rows > 0)
while($row = $query->fetch_assoc())
$json['id'] = $row['id'];
$json['name'] = $row['name'];
array_push($clientdata, $data);
// Return results as json encoded array
echo json_encode($json);
Everything is working fine except that on form submit i want to post the ID field of the client instead of name.
Any help appreciated :)
twitter-bootstrap autocomplete typeahead
I am using bootstrap typeahead to suggest values from database for a form field. Here is the type ahead code.
$(document).ready(function()
$('#client_id').typeahead(
source: function(query, result)
$.ajax(
url:'client_search.php?extraParams=<?php echo $merchant_id;?>&',
method:"GET",
data:query:query,
dataType:"json",
success:function(data)
console.log(data);
result($.map(data, function(item)
return item;
));
)
)
);
The client_search.php file returns two values in json format -
$clientdata = array();
if($query->num_rows > 0)
while($row = $query->fetch_assoc())
$json['id'] = $row['id'];
$json['name'] = $row['name'];
array_push($clientdata, $data);
// Return results as json encoded array
echo json_encode($json);
Everything is working fine except that on form submit i want to post the ID field of the client instead of name.
Any help appreciated :)
twitter-bootstrap autocomplete typeahead
twitter-bootstrap autocomplete typeahead
asked Nov 9 at 12:52
Sohail Ahmed
61
61
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226058%2ftypeahead-bootstrap-selected-value-post%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password