This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » ezjscore retrieve post parameteres in...

ezjscore retrieve post parameteres in template

ezjscore retrieve post parameteres in template

Monday 03 October 2011 10:29:52 am - 7 replies


I am used to useing the ::param in my ezjscore, but i know that it iss possible to send the params as json as well. How can i retrieve the json params in my template?

Can i call my json params what i want or do i need to call them $arg1:val

Hope you can help.

Monday 03 October 2011 1:18:18 pm



i ussually send the whole form using jQuery like this:

        $.ez( 'class::function', $(this).parent().serializeArray(), function( data ){

$(this).parent() == the form

And then you can retrieve the variables in the $_POST variable in your ezjscorefunction..

Or you can build a array manually:

var params = {parameter1:"test", nodeId:"2", someOtherParameter:"parameterValue"};
$.ez( 'class::function', params, function( data ){


Did this help or did i misunderstand the question?

Modified on Monday 03 October 2011 1:43:10 pm by Håvard Bergersen

Friday 07 October 2011 10:04:45 am

Thanks for helping. You did understand me partly. However what i really ask for is how can i use template (not a php class, but a templat function) to retrieve post params.

I am used to getting the values when they are added as templateclass/functionname::arg1::arg2, but not as templateclass/functionanme,{arg1:som value, arg2:another value}

Any help?

Friday 07 October 2011 10:14:40 am

Hmmmm.. Sorry.. Maby I am slow, but i'm not really sure what you mean..

Why do you need to retrieve post params in the template?

Could you post your code?

Friday 07 October 2011 11:10:30 am

via ezhttp?

Friday 07 October 2011 11:23:50 am

Sure you could, but then this post is not about jSCore.. happy.gif Emoticon

{ezhttp( 'variableName', 'post' )}

Friday 07 October 2011 12:43:07 pm

Hm. It still is about ezjscore as we are talking about how one may retrieve the post params from the ezjscore jquery javascript function.

I was hoping that the ezjscore framework automatically checked if any post params were available and made these available in the template.

Does this mean that as long as you do not create your own php class functions to be used with ezJscore than we should really base it on the "templateclass/functionanem::param1::param2" syntax

the syntax just becomes somewhat messay if you have several params to passs , that the main reason why i would like to use the post params via json.

Friday 07 October 2011 2:41:32 pm

Disclaimer: strictly personal opinion follows:

Well, you could json_encode your params and put them in the query string, separated via ::

This works as long as there is no :: or \n in them of course

And ezjscore does not supply any method to escape the "::" token, either in the js side or the server side.

And, whether you access your POSTed params in php code or in tpl code, the fact that you have to ignore the list of values supplied to you and go to the http request to find them breaks the encapsulation principle, which is very important.

To be brutally honest,for ajax calls, I'm still convinced that sticking to a well known standard such as xmlrpc or jsonrpc is a better choice (but you know I'm biased).

And I would not expect a lot of improvements to come from eZ to the ajax support of ezjscore, since now it's all about the REST apis. But any pull request is of course wlcome blunk.gif Emoticon


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from