Is it possible to update an object property from an ajax call?

I have this object hard coded into my page. Is it possible to update the commented property with ajax? This feels like a dumb question for a yes or a no, but I never attempted this before… If possible, how would I target that property from a separate script?


<script type="text/javascript">
						AmCharts.makeChart("left_gauge_div",
							{
								"type": "gauge",
								"pathToImages": "http://cdn.amcharts.com/lib/3/images/",
								"arrows": [
									{
										"id": "GaugeArrow-1",
										"value": 23   // <-------------------------------------------- can i update this value?
									}
								],
								"axes": [
									{
										"bottomText": "23",
										"bottomTextYOffset": -20,
										"endValue": 220,
										"id": "GaugeAxis-1",
										"valueInterval": 10,
										"bands": [
											{
												"color": "#00CC00",
												"endValue": 90,
												"id": "GaugeBand-1",
												"startValue": 0
											},
											{
												"color": "#ffac29",
												"endValue": 130,
												"id": "GaugeBand-2",
												"startValue": 90
											},
											{
												"color": "#ea3838",
												"endValue": 220,
												"id": "GaugeBand-3",
												"innerRadius": "95%",
												"startValue": 130
											}
										]
									}
								],
								"allLabels": [],
								"balloon": {},
								"titles": [
									{
										"id": "Title-1",
										"size": 15,
										"text": "Appointments Set"
									}
								]
							}
						);
					</script>


Well, where’s the ajaxy stuff, in relation to the page?

It sounds a bit like a tits kinda thing: Try It To See. We know from global-variable collisions that it’s certainly possible for scripts to influence each other inadvertently (or maliciously). But I take it this isn’t a global variable? Maybe you will have to make a copy of it and set it as a global variable, let the ajaxy script adjust the global, and have your script copy back the “new” version. Usually a bad idea, I know, but something others have used with care.

Or instead of the hardcoded value, it could be calling the ajaxy script and have an “or 23” or 23 as a default until some function runs. Like
“value”: runThisFunc() || 23 {
(prolly a dumb idea if this is async, but the value can point to a function that returns a value if you want).

You might have to post more of what your situation is and who’s calling the ajax request etc. You might be looking for message-passing, or some of the principles of reactive programming (where variables change their values externally to those who read or write to them). These might be called reactive variables, which isn’t a built-in for javascript running on browsers but there are libraries who emulate it.