Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // in a js "class"
- this.ajaxError=function(response)
- {
- alert('AJAX error!'+response)
- }
- this.ajax=function(url,type,success,error)
- {
- $.ajax({
- url: url,
- type:type,
- success: success,
- error: error
- });
- }
- this.showMessage=function(response)
- {
- alert(JSON.parse(response));
- }
- this.open=function()
- {
- alert("1");
- this.ajax('/message/open/173','text',this.showMessage,this.ajaxError);
- }
- //php in vew/open.ctp
- <?php
- ?>
- //messagecontroller.php
- public function open($stream_id)
- {
- /*$result = $this->Stream->find('first', array(
- 'conditions' => array('Stream.id' => $stream_id
- )
- ));
- echo json_encode($result);*/
- echo "id:".$stream_id;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement