0
votes

I am trying to pass array of values as parameter to controller action in YII Framework, My URL is like very hard to see with array values.

Calling Controller Action:

var jString = JSON.stringify(val);  
window.open ('".$this->createUrl('campaign/reportdrill')."/id/'+jString,'_blank');

URL Formed :

http://sks14/viacrm/campaign/reportdrill/id/%5B%7B%22Campaign%22:193,%22Filter%22:651,%22crm_post_code_categ_id%22:%221%22,%22crm_campaign_post_code_id%22:%22296%22,%22todate%22:%2214-05-2014%22,%22fromdate%22:%2201-05-2014%22,%22agent%22:%22%22%7D%5D

How to hide this parameter from user or is anyother way to pass array of values to controller action ?

1
try passing in $_POST parameter, POST method - Developerium
Can you give any example ? - US-1234

1 Answers

0
votes

This is the only way to pass parameters via the GET method of URLs. If you want to 'hide' the URL, use an AJAX load instead.

var jString = JSON.stringify(val);
$('body').load('".$this->createUrl('campaign/reportdrill')."/id/'+jString);

However, AJAX load cannot apply to opening a new window. You will still need to use your URL for that purpose.