开发者

CakePhp: $ajax->link: How to make something with the result on the complete action?

开发者 https://www.devze.com 2023-04-02 23:01 出处:网络
I\'m starting to use cakePhp for making ajax request(it use protoype). My controller return the correct value, but I can\'t find how to handle it when it returns:

I'm starting to use cakePhp for making ajax request(it use protoype).

My controller return the correct value, but I can't find how to handle it when it returns:

<?php echo $ajax->link("Update my ***** div", array( 'controller' => 'products', 'action' => 'test') , array("complete" => "update(request)") ); ?>

if in my javascript update method, I "alert(request), I see only the XMLHTTPRequest object, not the response.

I need to work on the result with javascript once I received the result, how can I do this???

I saw something( Append Textarea with Cake PHP using Ajax ), but it was so dirty that I thought it wasn't the right things to do: use the "update" option to update a hidden div with this result, and then parse this div with javascript when I complete, but it means that I've to own one hidden div per ajax call(I will have some parralels ajax calls), and I feel not happy with the giving something to the browser for render开发者_开发问答ing only to retrieve my ajax call.

Thank you very much


<?php echo $ajax->link("Update my ***** div", array( 'controller' => 'products', 'action' => 'test') , array("complete" => "javascript:update(request.responseText)") ); ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消