Mehboob Alam wrote:
Brad,

Since you have JavaScript in the mix, you should consider the JSON data
structure standards to cache your data. Just a suggestion..

http://json.org/
This does look like the best way to go. I've hacked together some code to build the JSON based on 4D data, but am running into a problem when trying to set the cookie with Javascript. I create an Active4D variable named $json. I've inspected the variable closely and it is valid JSON based on the grammar at json.org.

Here's an example of the JSON containing the "clipboard" data

{
  "component_name":"Gizmo",
  "component_descript":"This is a test",
  "component_cost_usd":"100",
  "manufacturer":"Acme Widgets",
  "manuf_address":"123 The Acme Way\r\nCity of Industry, CA\r\n90601",
  "manuf_model_num":"GZ5000",
  "manuf_model_name":"The Super Gizmo (tm)",
  "manuf_part_num":"",
  "property_owner":"",
  "export_ctl_class_num":"EAR99",
  "ops_tracking_code":"",
  "calibration_flag":"0",
  "calib_interval_days":"",
  "locationkey":"33",
  "location":"At Facility"
}

If I click on the button coded below, the Cookie is not set and the Javascript 
console reveals an error.

<input type="button" value="Copy Data" onClick="Set_Cookie('PARTS_CLIP','<%= $json %>',1);" />

I'm trying the pass the cookie name, JSON, and expire interval to a Javascript function that sets the cookie. I've tested the function with a normal text cookie value and it works. If I try to pass the JSON the javascript chokes. It doesn't seem to like that the string in $json starts with an "{". Is that because the string is executable Javascript?

Is there a way to work around this?

Thanks,

Brad



_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to