+ Start a Discussion
avimeiravimeir 

A4J is not a function


We are struggling with a weird and undocumented behavior of Visualforce with Ajax. Here is the description:
 
The problem we face is, that after loading page by $.get(), the AJAX doesn't work properly.

Here is the VisualForce code:

    
  <apex:actionFunction action="{!onShowReservation}" name="showReservation"
          rerender="reservationSteps">
          <apex:param name="selectedRoomId" value="{!selectedRoomId}"
              assignTo="{!selectedRoomId}" />
      </apex:actionFunction>

 



Here is the JavaScript code:

     showReservation(RoomID);

Error we're getting on Firebug:
 "A4J is not a function".


Ugly solution that we've found, and I am not happy about at all:

Adding hardcoded lines to the code
<script src="/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script>
<script src="/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"></script>

 



wil make AJAX work, but other scripts are still out of reach.
 

 

joshbirkjoshbirk

Sorry, what exactly do you mean by "The problem we face is, that after loading page by $.get(), the AJAX doesn't work properly."  How are you loading this page?