keyup イベントでページ自体にパラメーターを送信しています。
ajaxのようにパラメータを送信していますurl:"http://localhost/application/views/pages/users/tags.php?tagfilter=lif",
JavaScript関数でその値を取得する('/instruction/showtags/<?php if( isset($_GET['tagfilter']) && $_GET['tagfilter'] == "") {echo $_GET['tagfilter'];} ?> ', {
コンソールを確認しましたが、エラーも警告も表示されていません。しかし、パラメーターを送信していないか、パラメーターを取得していない可能性があると確信しています。
パラメータが送信されない理由を教えてください。ajaxコードの書き方は正しいですか?
私の質問を理解できなかった場合は、お知らせください。別の方法で説明します。
完全なソース コード:
tags.php
<input placeholder="Search" id="tagfilter" name="tagfilter" type="text"/>
Jquery/ajax関数
<script type="text/javascript">
$(document).ready(function() {
$('#tagfilter').keyup(function(e){
// alert("called");
$.ajax({
url:"http://localhost/application/views/pages/users/tags.php?
tagfilter=lif",
type:"get",
success: function(){
}
});
});
});
</script>
同じページを含む私の無限スクロールjsファイル
<script>
(function($) {
$.fn.scrollPagination = function(options) {
var settings = {
nop : 10, // The number of posts per scroll to be loaded
offset : 0, // Initial offset, begins at 0 in this case
error : 'No More Data To Display!', // When the user reaches the end this is the message that is
// displayed. You can change this if you want.
delay : 500, // When you scroll down the posts will load after a delayed amount of time.
// This is mainly for usability concerns. You can alter this as you see fit
scroll : true // The main bit, if set to false posts will not load as the user scrolls.
// but will still load if the user clicks.
}
.............................
.............................
.............................
アップデート:
私は正確に何をしようとしていますか?
jqueryで無限スクロールを実装しました。ページが読み込まれると、コントローラーが呼び出され、コントローラーからデータが取得され、ビュー ページに表示されます。
今、私は無限スクロールでこのページに検索を配置する予定です。私はテキストボックスを持っています。このテキストボックスから、キーアップイベントを検索しようとしています。
私はこのロジックを試しています。より良いロジックがある場合は、私と共有してください。これを実装するのに長い間苦労しているためです。