Welcome Guest, Not a member yet? Register   Sign In
ajax problem
#1

[eluser]MMCCQQ[/eluser]
dont work i dont know what happed

&lt;a href="#" onclick="Setinbox('read','&lt;?=$row-&gt;id;?&gt;');">Click Aqui</a>

this is JS , i trying to design a inbox like FaceBook

Code:
function Setinbox(set,id){
        
        var set = document.getElementById(set);
        
        if(!set.className){
        
        
var url = "/inbox/Setread";

var pars = "id="+id;

var ajax = new Ajax.Request( url, {

                                parameters: pars,

                                method:"get",

                                onSuccess: function(){
                                    
                                    set.setAttribute("class", "new");
                                    
                                 }

                                }
                                );

        
    }
    else{
        
        var url = "/inbox/Setread";

var pars = "id="+id+"&read=0";

var ajax = new Ajax.Request( url, {

                                parameters: pars,

                                method:"get",

                                onSuccess: function(){
                                    
                                    set.setAttribute("class", "");
                                    
                                 }

                                }
                                );
    }
}
#2

[eluser]xwero[/eluser]
Instead of pars add the key-value pairs to your url.
"/inbox/Setread/id/"+id
#3

[eluser]MMCCQQ[/eluser]
like this?



function Setinbox(set,id){

var set = document.getElementById(set);

if(!set.className){


var url = "/inbox/Setread"+id;


var ajax = new Ajax.Request( url, {



method:"get",

onSuccess: function(){

set.setAttribute("class", "new");

}

}
);


}
#4

[eluser]MMCCQQ[/eluser]
dont work , dont show any error nothin, i using Firebug , dont detect any activities when i click




Theme © iAndrew 2016 - Forum software by © MyBB