Ajax.Updater syntax

new Ajax.Updater(window.opener.document.getElementById(‘facilityBookingFrm’), saveBookingUrl, {asynchronous:true, evalScripts:true, method:’POST’, onComplete:function(request, json){ setCalendar(‘\”+objDateS+\”‘);  setTargetDate(‘event2’, ‘\”+objDateS+\”‘ ); timeSlotsArray = new Array(); timeSlotsConflictArray = new Array();  thirdClick = false; clearBoxes(0); eval(‘\”+evalToScript+\”‘); Calendar.setup({ inputField : ‘start_date’, ifFormat : ‘%b, %d %Y’, button : ‘f_trigger_c’, align : ‘Tl’, position : positionArr,  singleClick : true }); Calendar.setup({ inputField : ‘end_date’, ifFormat : ‘%b, %d %Y’, button : ‘e_trigger_c’, align : ‘Tl’, position : positionEArr,  singleClick : true }); }, onLoading:function(request, json){}, parameters: { startDate: fab_starttime, selectedSlot: selectedSlot, repeatWeekly: fab_repeat_weekly, repeatWeekday: fab_repeat_weekday, repeat: fab_repeat, reminder_tim: fab_sendreminder_type, reminder_mins: fab_sendreminder_beforemins, fac_id: fac_id, endDate: fab_endtime, selectedConflictSlot: selectedConSlot, reConflicts: reConflicts, currdateStr: currdateStr, otherHVar: otherHVar, conflictResol: ‘1’ } });

The syntax goes as follows:

new Ajax.Updater ( ‘elementToBeUpdated’, ‘urlInRequest’, { asynchronous:true, evalScripts:true /* true or false*/, method: ‘POST’ /*’POSTorGET’*/, onComplete:function(request, json){ /*Action after completion of request */ } , onLoading:function(request, json){ /*Action while loading */ }, parameters: { /* post parameters to be passed*/ } } )

Advertisements

2 thoughts on “Ajax.Updater syntax

  1. i am unable to retriever values on php page after passing them on AjaxUpdater perhaps their is some problem in the syntax on my Java Script….can some1 paste an example where u are sending 2 or more parameters in AjaxUpdater call…..

    • hi fahad,

      here i have given an example of how to pass parameters using post method.

      new Ajax.Updater ( ‘elementToBeUpdated’, ‘urlInRequest’, { asynchronous:true, evalScripts:true /* true or false*/, method: ‘POST’ /*’POSTorGET’*/, onComplete:function(request, json){ /*Action after completion of request */ } , onLoading:function(request, json){ /*Action while loading */ }, parameters: { startDate: fab_starttime, selectedSlot: selectedSlot} } )

      here i have passed two parameters with post method. they are startDate: fab_starttime and selectedSlot: selectedSlot
      where you can get the values of both these parameters in php page as $_POST[‘startDate’] and $_POST[‘selectedSlot’]
      and if you are using symfony you can get as
      $this->getRequestParameter(‘startDate’) and $this->getRequestParameter(‘selectedSlot’)

      still if you are facing difficulties. provide me your code and i will check for the error there in.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s