Welcome Guest, Not a member yet? Register   Sign In
jQuery + AJAX + CI
#1

[eluser]Erik Larsson[/eluser]
Hello!
Im trying to build a AJAX request with jQuery and CI.
the function should work like this.
I have a list of words like this.
Code:
<ul id="searchword_ul">
             <li id="searchword_kuken">
                 &lt;?=form_open('adminpanel/testformremove')?&gt;
                 <div style="display:none">
                     &lt;?=form_input('sokord_id', '3', 'id="sokord_id"')?&gt;
                     &lt;?=form_input('register_id', '1', 'id="register_id"')?&gt;
                     &lt;?=form_input('sokordet', 'kuken', 'id="sokordet"')?&gt;
                 </div>
                 kuken <a href="" id="removeSearchword">x</a>
                &lt;?=form_close()?&gt;
            
             </li>
             <li id="searchword_test">
                 &lt;?=form_open('adminpanel/testformremove')?&gt;
                 <div style="display:none">
                     &lt;?=form_input('sokord_id', '3', 'id="sokord_id"')?&gt;
                     &lt;?=form_input('register_id', '1', 'id="register_id"')?&gt;
                     &lt;?=form_input('sokordet', 'test', 'id="sokordet"')?&gt;
                 </div>
                 test <a href="" id="removeSearchword">x</a>
                 &lt;?=form_close()?&gt;
             </li>
         </ul>
      </div>

and a Javascript like this
Code:
$("#removeSearchword").click(function(){
                var sokord_id = $("#sokord_id").val();
                var register_id = $("#register_id").val();
                var sokordet = $("#sokordet").val();
                
                
                $.post("&lt;?=base_url()?&gt;index.php/adminpanel/testformremove",
                   { sokord_id: sokord_id, register_id: register_id },
                       function(data){
                            $("#searchword_"+ sokordet).slideUp("normal", function() {

                            $("#searchword_"+ sokordet).before('');
                        });
                    }
                );
                return false;
        });

The problem im having, is that i can only press the "x" (remove) link on the first one, not on the next one. Nothing happens when i press the secound "x".

Is CI creating this?

Best
Erik


Messages In This Thread
jQuery + AJAX + CI - by El Forum - 07-26-2009, 02:05 PM
jQuery + AJAX + CI - by El Forum - 07-26-2009, 02:40 PM
jQuery + AJAX + CI - by El Forum - 07-26-2009, 03:04 PM
jQuery + AJAX + CI - by El Forum - 07-26-2009, 09:01 PM
jQuery + AJAX + CI - by El Forum - 07-27-2009, 02:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB