Estou com um problema no meu código, precisava fazer um campo de pesquisa só que me deparei com um problema os campos inputs ignora a função javascript e jquery e no caso dos inputs submit nem atualizar a página meu código é o seguinte:
//parte javascript:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</script>
<script>
jQuery.noConflict();
(function($) {
$('#bs-mrb').on('keyup',function(e){
if(e.which == 13) {
// if($('#bs-prod').val() != "") {
var dato = $('#bs-mrb').val();
var x = $('#str').val();
var url = x+'_functions.php?action=buscaMrb';
// alert("dato: "+dato+" x: "+x+" url: "+url);
$.ajax({
type:'POST',
url:url,
data:'dato='+dato,
success: function(datos){
$('#agrega-registros').html(datos);
r1 = tooltip();
}
});
return false;
}
// }
});
})(jQuery);
</script>
//parte HTML:
<body onLoad="tooltip();">
<?php
$funcao = $_REQUEST["op"];
if (function_exists($funcao)) {
call_user_func($funcao);
}
function saida() {
titulo("FA - saída","course.png") ?>
<section>
<table border="0" align="center">
<tr>
<td>
<input type="hidden" name="str" id="str" value="aqm"/>
</td>
<form name="frm_pesq" method="post" action="">
<td width="300">
<input type="text" placeholder="ID / PartNumber / SN Item" name="pesq" size="25" id="bs-mrb">
<input type="hidden" name="str" id="str" value="fa"/>
</td>
</form>
</tr>
</table>
</section>
<div class="registros" id="agrega-registros">
<table class="table table-striped table-condensed table-hover nowrap">
<thead class="head">
<th nowrap width="10px">Status</th>
<th nowrap width="50px">ID</th>
<th nowrap width="160px">DataEntrada</th>
<th nowrap width="120px">PartNumber</th>
<th nowrap width="140px">SNItem</th>
<th nowrap width="140px">Description</th>
<th nowrap width="150px">Defect</th>
<th nowrap width="150px">TransferOrder</th>
<th nowrap width="10px">teste</th>
</thead>
<?php
aqui vai a query select * from tabela;
e trás as informações do banco.
após isso fecho a função saída();
} ?>
</table>
</div>
No campo input id="bs-mrb"
não chama nenhuma função já tentei javascript e jquery não funciona só reconheceu um alert();
colocando dentro do input por exemplo:
<input type="text" value="pesquisar" id="bs-mrb" onkeypress="alert('teste');">
Assim funcionou mais se eu colocar um alert em uma função não funciona alguém pode me ajudar nisso.
Detalhe minha query está funcionando o problema é só na chamada da função javascript no input e também já tentei fazer um onsubmit dentro do formulário e não funcionou e também esta pagina estou chamando dentro de uma de outra pagina index.
com o codigo abaixo:
//javascript que chama a pagina acima.
<script>
function display_c(){
setInterval('getInfo()',30000);
}
function getInfo(){
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("conteudo").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "MRB_Dados.php?op=<?php echo $op;?>", true);
xmlhttp.send('conteudo');
}
</script>
//e a parte html que recebe a pagina acima dentro da div conteúdo.
<body onload="display_c(); getInfo('<?php echo $op ; ?>');">
<div id="header">
<div id="masthead_upper" class="masthead full fullwidth">
<div class="container_20">
<div class="grid_6" id="logo"> <a href="http://<?php echo $_SERVER['SERVER_NAME'] ?>/coffe/mrb.php?op=<?php echo $op;?>">Lenovo</a> </div>
<div style="position:absolute;color:white;font-family:Arial;font-size:32px;top:15px; right:20px; text-align: right;">Controle</div>
<div style="position:absolute;color:white;font-family:Arial;font-size:10px;top:48px; right:20px; text-align: right;">Developed by Engineering System</div>
<div style="position:absolute;top:65px; left:10px; text-align: left;">
<nav class="grid_20 cf" id="menus">
<ul class="fullwidth" id="navigation"><br>
<li class="first" id="laptops"><font color="#FFCC00" face="verdana" size="2"><b><?php echo strtoupper($_SESSION['usuario'])." - ".strtoupper($_SESSION['nome']);?></b></font>
<?php if(!empty($_SESSION['usuario'])) { ?>
<font color="#FFCC00" face="verdana" size="2"><?php echo " - ".strtoupper($_SESSION['depto']);?>| <a style="color: #fff;" href="logout.php">[logout]</a> | <span id="countDown" style="color:white"></span></font>
<?php } ?>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="container">
<!-- begin: Main Grid -->
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" align="left" valign="top" bgcolor="#FFFFFF" class="landingcontent"><br />
<table width="100%" height="100%" border="1" cellpadding="4" cellspacing="0">
<tr>
<td class="columnR" width="87%" valign="top" align="left">
<!-- inicio td -->
<div id="conteudo"></div>
<!-- fim td -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- end: Main Grid -->
<!-- begin: Footer -->
<?php // include "footer.php"; ?>
</body>
</html>