Is it possible the Javascript variable value to the php url parameter? please see following code and give a suggestion how to do this? Html code:
foreach($rd as $data){
echo "<tr><td>".$data[role_name]."</td><td>".$data[role_description]."</td><td><a href=".$this->action('edit', $data['role_id']).">Edit</a></td><td>".$ih->button_js(t('Delete'), "deleteRole('".$data['role_id']."')", 'left', 'error')."</td></tr>";
}
in this code i call JS function deleteRole?(): script:
function deleteRole(myvar) {
if (confirm('<?php echo $delConfirmJS ?>')) {
location.href = "<?php echo $this->url('/role/add_role/', 'delete', 'myvar')?>";
}
}
In my controller page i receive the myvar as string not the value? controller.php
public function delete($id){
echo $id;
exit;
$delete = roleinfo::delete($id);
$this->redirect('/role/add_role'); }
this echo print "myvar" only not a value? Please suggest me its write way or not ? else how to do this?
thanks Kumar