This cannot work. you can send an ajax-request to a resource where you have a ditto-call with request-extender for example and work with that responce-datas, if you want so.
But I’m sure the community knows better ways for you, when you explain, what you are after in details.
-
☆ A M B ☆
- 24,524 Posts
Ditto is a PHP script which is run on the server as part of generating the page you receive. Nothing you can do with the page in your browser can have any effect on it.
One way you could do something like that is to use AJAX, pass the desired parameter/value pairs to the PHP AJAX back-end processor (use a MODx snippet for this, and use document with a blank template and only the snippet tags for the content to provide the MODx API functions to your processor), and then use the $modx->runSnippet() function to run Ditto with the passed parameters and values. The AJAX processor would return the Ditto output (as HTML, or JSON-encoded), and your Javascript AJAX post-processor would insert the returned Ditto output in place.
You could use a form or a link with a query string to pass the values if you were willing to have a full page refresh. In this case also you would need a snippet to get the GET or POST values, then use $modx->runSnippet() to run Ditto with the passed values.
That makes sense guys thanks, I think I need to re-architect rather than try and patch up what I have done so far, still a bit new to ModX and wasn’t sure how the templating worked.
Cheers
-
☆ A M B ☆
- 24,524 Posts