Skip to content

Instantly share code, notes, and snippets.

@tareko
Created May 24, 2012 23:25
Show Gist options
  • Select an option

  • Save tareko/2784856 to your computer and use it in GitHub Desktop.

Select an option

Save tareko/2784856 to your computer and use it in GitHub Desktop.
Ceeram's selectbox issue
<?php
$this->Js->get('#UserRoleId')->event('change',
$this->Js->request(array(
'controller'=>'groups',
'action'=>'index',
'ext' => 'json'
), array(
'update'=>'#UserGroupId',
'async' => true,
'method' => 'post',
'dataExpression'=>true,
'data' => $this->Js->serializeForm(array(
'isForm' => false,
'inline' => true
))
))
);
What it should look like:
<script>
//<![CDATA[
$(document).ready(function () {
$("#UserRoleId").bind("change", function (event) {
$.ajax({
async:true,
data:$("#UserRoleId").closest("form").serialize(),
dataType:"html",
success:function (data, textStatus) {
$("#UserGroupId").html(data.groups);
}, type:"post", url:"\/groups.json"});
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment