In attempt to simplify the solution I have changed the code slightly. The function is now defined in the static JS file so is not present in the code being inserted via the AJAX call.
Instead the AJAX call now inserts some HTML with a single line of Javascript included, this is defining a variable ( splitJSON ) with a JSON object. Anyone have any ideas as to why the variable never gets the new values? This can be seen here : http://gpsactivitymanager.com/events/2b77d598-6f65-45b3-a879-c99a1c600f69/# Navigate to the "splits" from the navigation strip at the top, then change units from "KM" to "Miles" in the dropdown on the left hand side of the screen. thanks RK On Dec 22, 8:15 pm, bbbs <[EMAIL PROTECTED]> wrote: > Hello all, > > I have a script that uses a Ajax.Updater call to update the contents > of a DIV. The code being inserted includes a javascript function, > which is "called" by onClick event elsewhere in the HTML. > > The page initially works fine in that the DIV gets the right content, > the Javascript inserted works fine. > > The problem I have is that if I call the Ajax.Updater again then the > javascript in the second call does not seem to "refresh" that in the > first call. > > The Javascript has something along the lines of : > > <script type="text/javascript"> > > splitInfo = function(splitNumber) { > var splitJSON = <? echo json_encode($m_array); ?>; > var latlng1 = new GLatLng(splitJSON.data[splitNumber].start_lat, > splitJSON.data[splitNumber].start_lon); > var latlng2 = new GLatLng(splitJSON.data[splitNumber].fin_lat, > splitJSON.data[splitNumber].fin_lon); > addSplitMarker(latlng1,latlng2); > } > </script> > > As you can see there is some PHP in there to insert a JSON object, > which is different on each call. > > On the first call the JSON is evaluated correctly and things work > fine. On the second call the HTML is generated correctly ( checked via > FireBug ), but the "new" function does not seem to replace that > defined from the first call. > > Where am I going wrong... > > thanks > RK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
