Welcome Guest, Not a member yet? Register   Sign In
Simple vote up/down?
#4

[eluser]Sumon[/eluser]
Very easy with AJAX also. Use former solution by ajax.
Lets say your url is: www.mysite.com/counts/3 (You have tested this works fine when you hit this url directly)
For example consider this is your AJAX function.
Code:
[removed]
    function CreateNewHttpObject()    //Create an Instance of HTTP request.
    {
        var xmlHttp=null;
        try{          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
        }
        catch (e){          // Internet Explorer
            try{
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
              catch (e){
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
          }
        return xmlHttp;
    function DisplayOutput (divID)
    {
        var ObjHttp= new CreateNewHttpObject();
        if(ObjHttp)
        {
            var obj = document.getElementById(divID);
            ObjHttp.open("GET", 'www.mysite.com/counts/3');
            ObjHttp.onreadystatechange = function()
            {
                if (ObjHttp.readyState == 4 && ObjHttp.status == 200)
                    obj[removed] = ObjHttp.responseText;
            }
            ObjHttp.send(null);
        }
    }

Simply call the function from your buttons/images which are labeled “up” and “down”
Code:
DisplayOutput('divwhereyourCurrentup8show')
I Hope you get my point.


Messages In This Thread
Simple vote up/down? - by El Forum - 08-10-2008, 08:47 PM
Simple vote up/down? - by El Forum - 08-10-2008, 09:04 PM
Simple vote up/down? - by El Forum - 08-10-2008, 09:11 PM
Simple vote up/down? - by El Forum - 08-10-2008, 09:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB