+ Start a Discussion

actionFunction passing null to controller even though jQuery alert says there's a value

Passing an id from jquery to the actionfunction so it can do a page redirect. I had it working but for some reason it's not passing an id anymore, just a null. When I do alert(id); in the function being called, the alert comes up with the requested id. For some reaosn the id seems to get lost when going from jQuery to the action function. Any idea why this might be happening?

        j$('#Edit_Asset').live('click', function(){

        function callActionMethod(){

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<apex:form >
<apex:actionFunction name="pgRedirect_EditAsset" action="{!RedirectToEditAsset}" immediate="true">
    <apex:param name="IdParam" assignTo="{!AssetId}" value="" />

Here's the apex

public String AssetId                               {get;set;} 
       public PageReference RedirectToEditAsset()
            string url='/apex/AS_AssetEdit_m?id='+AssetId;
            PageReference pageRef = new PageReference(url);
           return pageRef;


JHayes SDJHayes SD

Have you taken a look at the HTTP request that gets sent when the actionFunction is invoked?  Does it include the correct  variable/value?  In Chrome you can hit CTRL-SHIFT-I and select the Network tab to view the request.


Since I'm just getting my feet wet with jQuery I'm not too familiar with using the debugger. I don't see how I could look at HTTP request, most of the pages don't exist once you click on them.
Here's a screenshot.