Jquery does not work in PHP

0

I do not know why. The page does not work. Does anyone know how to help me figure out the problem? I want the date mask to work in the data and the Venc_Garantia %

Can anyone help me?

<html>
<head>
<script src="C:\wamp\www\cadastro\javascript\jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="C:\wamp\www\cadastro\javascript\jquery.maskedinput.min.js" type="text/javascript"></script>

<script>
jQuery(function($){
$("#data").mask("99/99/9999",{placeholder:" "});
$("#venc_garantia").mask("99/99/9999",{placeholder:" "});
});
</script>

<title></title>
</head>
Caso NAO seja DELL clicar aqui: <input name="cadastro_dell" type="button" 
onClick="location.href='http://localhost/cadastro/cadastro.php'" value="Cadastro DELL">
<body>
<form name="signup" method="post" action="cadastrando_dell.php"> <br /><br />
Fabricante: <input type="text" name="fabricante" maxlength="10" /> <br /><br />
Modelo: <input type="text" name="modelo" maxlength="50" /> <br /><br />
Tipo: <input type="text" name="tipo" maxlength="50"/> <br /><br />
Data de Envio(ano-mes-dia): <input type="text" name="data" id="data"/> <br /><br />
URL DELL: <input type="text" name="url" maxlength="100"/> <br /><br />
Numero de serie: <input type="text" name="serie" maxlength="12"/> <br /><br />
Proprietario: <input type="text" name="proprietario" maxlength="30"/> <br /><br />
Origem: <input type="text" name="origem" maxlength="30"/> <br /><br />
Venc. Garantia(ano-mes-dia): <input type="text" name="venc_garantia"          id="venc_garantia"/>
Tipo de Instalacao: <input type="text" name="tipo_instalacao" maxlength="30"/> <br />               
Configuracao: <input type="text" name="configuracao" maxlength="150"/> <br /><br />
uname_a: <input type="text" name="uname_a" maxlength="100"/> <br /><br />
Instalacao: <input type="text" name="instalacao" maxlength="250"/> <br /><br />
Situacao (status): <input type="text" name="status" maxlength="15"/> <br /><br />
Servicos: <input type="text" name="servicos" maxlength="150"/> <br /><br />


Descricao: <input type="text" name="descricao" maxlength="150" /> <br /><br />
Quantidade: <input type="text" name="quantidade" maxlength="5"/> <br /><br />
Numero de Tombamento: <input type="text" name="tombamento" maxlength="13"/> <br /><br />
Local de Uso: <input type="text" name="local" maxlength="20"/> <br /><br />


<input type="submit" value="Cadastrar DELL" name="botao"/>



</form>

<?php

if(isset($_POST["botao"])){
    if(empty($tipo) || empty($tombamento) || empty($status)){
            echo "Preencha todos os campos!";           
    }
}
?>      

</body>

</html>

'

I'm using WAMP with everything updated, but even referring to the Jquery file I do not see applied to the mascara, what can it be?

    
asked by anonymous 25.07.2014 / 15:10

4 answers

4

If you're running this page on a SERVIDOR you should reference the javascript as well

<script src="/cadastro/javascript/jquery-1.5.2.min.js"></script>
<script src="/cadastro/javascript/jquery.maskedinput.min.js"></script>

The error probably happens because this javascript file reference is inaccessible on a server.

    
25.07.2014 / 15:16
1

Change file paths

<script src="C:\wamp\www\cadastro\javascript\jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="C:\wamp\www\cadastro\javascript\jquery.maskedinput.min.js" type="text/javascript"></script>

by:

<script src="nome_da_pasta_ou_projeto/javascript/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="nome_da_pasta_ou_projeto/javascript/jquery.maskedinput.min.js" type="text/javascript"></script>
    
25.07.2014 / 15:15
1

Friend, the error is in how you read the scripts, as your page is running on a WAMP server it does not access the files normally. Take a look at the browser error console by clicking on inspect element in Chrome and then on console, it probably must have returned two 404 errors and unknown function errors since the scripts were not loaded. Another tip is to load jquery-1.5.2.min.js directly from Google's CDN, like this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    
25.07.2014 / 20:08
-3

It could work if you report in SRC something like:

<script src="file:///c:/myScript.js">
    
25.07.2014 / 15:34