how to pass value to controller??

Posted by rajesh on Stack Overflow See other posts from Stack Overflow or by rajesh
Published on 2010-05-05T12:11:30Z Indexed on 2010/05/05 12:48 UTC
Read the original article Hit count: 254

Filed under:
|
|
|

When I try to pass url value to controller action, action is not getting the required value.

I'm sending the value like this:

function value(url,id)
{
    alert(url);
    document.getElementById('rating').innerHTML=id;
    var params = 'artist='+id;
    alert(params);
    // var newurl='http://localhost/songs_full/public/eslresult/ratesong/userid/1/id/27';
    var myAjax = new Ajax.Request(newurl,{method: 'post',parameters:params,onComplete: loadResponse});        
    //var myAjax = new Ajax.Request(url,{method:'POST',parameters:params,onComplete: load});
    //alert(myAjax);

}

function load(http) 
{
    alert('success');
}

and in the controller I have:

public function ratesongAction()
{
    $user=$_POST['rating'];
    echo $user;
    $post= $this->getRequest()->getPost();
    //echo $post;
    $ratesongid= $this->_getParam('id');
}

But still not getting the result. I am using zend framework.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript