Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. $(function() {
  2. $("#typeahead").typeahead({
  3. source: function (query, process) {
  4. $.ajax({
  5. url: 'data.php',
  6. type: 'POST',
  7. data: 'query=' + query,
  8. dataType: 'JSON',
  9. async: true,
  10. success: function(data) {
  11. process(data);
  12. }
  13. });
  14. }
  15. });});
  16.  
  17. if (isset($_POST['query'])) {
  18.  
  19. require_once('conexion.php');
  20.  
  21. $query = $_POST['query'];
  22. $sql = "SELECT * FROM tab_medicinas_2 WHERE descripcion LIKE '%".$query."%'";
  23. $res = mysql_query($sql) or die(mysql_error());
  24.  
  25. while($fila = mysql_fetch_assoc($res))
  26. {
  27. $return[] = $fila['descripcion']." (".$fila['um'].")";
  28. }
  29.  
  30. echo json_encode($return); }
  31.  
  32. <div id="tab4" class="tab-content-1">
  33. <table class="table table-bordered">
  34. <tr>
  35. <td width="28%">Denominaci&oacute;n seg&uacute;n DCI, especificaciones t&eacute;cnicas, unidad de manejo</td>
  36. <td width="24%">Dosis</td>
  37. <td width="24%">Duraci&oacute;n del tratamiento</td>
  38. <td width="8%">Cant. Req.</td>
  39. <td width="16%">Indicaci&oacute;n Espec&iacute;fica</td>
  40. </tr>
  41. <tr>
  42. <td width="28%">
  43. <input name="descripcion" class="span4" id="typeahead" type="text" data-provide="typeahead" />
  44. </td>
  45. <td width="24%">
  46. <input name="dosis" class="span3" id="dosis" type="text" />
  47. </td>
  48. <td width="24%">
  49. <input name="duracion" class="span3" id="duracion" type="text" />
  50. </td>
  51. <td width="8%">
  52. <input name="cantidad" class="span1" id="cantidad" type="text" />
  53. </td>
  54. <td width="16%">
  55. <input name="indicacion" class="span2" id="indicacion" type="text" />
  56. </td>
  57. </tr>
  58. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement