如何使用 eclipse-mars IDE 将 jquery 插件设置到我的 codeigniter 项目中


How to setup jquery plugin into my codeigniter project using eclipse-mars IDE


我已经从网络下载了jquery-validation-1.14.0.zip文件。并且知道我正在尝试在我的项目中使用它,但我的问题是我不知道在我的 wamp 文件夹中放置文件夹(提取的文件(的确切位置,以及要对任何配置或 .htaccess 文件进行哪些更改。由于我已经付出了所有完整的 3-4 天来自己配置它,但最终别无选择,我在这里发布我的问题,以便这里的任何人都可以帮助我。基本上这是我的文件夹结构;-C:''wamp''www''developer''jquery-validation

控制器:- C:''wamp''www''developer''application''controller

如何使用在我的视图中调用脚本文件:-

<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 未找到 27ms]
获取http://localhost/developer/index.php/jquery-validation/dist/jquery.validate.js [HTTP/1.1 404 未找到 30ms]
引用错误: $ 未定义

无论如何,请让我摆脱所有这些..现在我完全沮丧了。非常非常感谢提前..

问题仍然是相同的@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>

我的基本网址是本地主机/开发人员
JS文件的文件夹和文件位置与我的代码相同。错误仍然相同

所有包含的资产都与

base_url('path/to/script.js');

所有链接都生成

site_url('controller/action/param');

看到您的新描述后,假设文件位于应用程序内的视图文件夹中,因此变为:-

<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>
jQuery(document).ready(function($){
$("#sub").click(function(){
    alert("hello");
});
});
</script>
</body>
</html>