【发布时间】:2016-02-09 18:15:20
【问题描述】:
我已经从网上下载了 jquery-validation-1.14.0.zip 文件。并且知道我正在尝试在我的项目中使用它,但我的问题是我不知道将文件夹(提取的文件)放在我的 wamp 文件夹中的确切位置,以及要对其中的任何内容进行哪些更改配置或 .htaccess 文件。因为我已经给了我全部的 3-4 天来自己配置它,但最后没有选择,我在这里发布我的问题,以便这里的任何人都可以帮助我。
基本上这是我的
文件夹结构;-
C:\wamp\www\developer\jquery-validation
控制器:- C:\wamp\www\developer\application\controllers
在我看来如何调用脚本文件:-
<html>
<head>
<script type="text/javascript" src ="../jquery-validation/lib/jquery.js"> </script>
<script type="text/javascript" src ="../jquery-validation/dist/jquery.validate.js"> </script>
</head>
我想在这里强调的另一件事是,在 eclipse-mars 中,我也包含了 jquery 库。现在我在 Javascript 资源中有 jquery 2.0 库。
当我简单地尝试使用警报功能时,在完成所有这些之后,我看到了很多错误。
错误:-
得到
http://localhost/developer/index.php/jquery-validation/lib/jquery.js [HTTP/1.1 404 Not Found 27ms]
得到
http://localhost/developer/index.php/jquery-validation/dist/jquery.validate.js [HTTP/1.1 404 Not Found 30ms]
ReferenceError: $ 未定义
无论如何,请让我摆脱所有这些......现在我非常沮丧...... 非常非常感谢提前..
@praveen 和@ichadhr 的问题仍然相同。为了更清楚地说明我的代码,这是一个简单的视图:
<html>
<head>
<script type="text/javascript" src ="<?php echo base_url('jquery-validation/lib/jquery.js');?>" ></script>
<script type="text/javascript" src ="<?php echo base_url('jquery-validation/dist/jquery.validate.js');?>"></script>
</head>
<body>
<form method="post" id="myform">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" name="name" id="name">
</div>
<button type="submit" class="btn btn-default" id="sub">Submit</button>
</form>
<script>
$("#sub").click(function(){
alert("hello");
$("#myform").valid();
});
</script>
</body>
</html>
我的基本网址是 localhost/developer
并且 js 文件的文件夹和文件位置与我的代码中的一样。
错误还是一样
【问题讨论】:
-
试试这个
<script type="text/javascript" src="<?php echo base_url("/jquery-validation/lib/jquery.js");?>"></script>
标签: javascript php jquery eclipse codeigniter