Selectable AJAX/normal behavior implementation
Orkan |
|
---|---|
# Trustmaster : Well, I'm quite skeptic about this idea, because it means that there will be at least 2 kinds of links to the same page: traditional and hash-based. It makes things easy to be messed for both devs and users. no, the "hash" part will only define the "page state". For example, if you have an ajax driven gallery, the hash part will define which photo you are currently viewing, so you can use this link later and share with others. This is nothing new. I will implement this on my Star Rating widget Demos tab soon, where I have two nested ajax tabs. There is a jQuery plugin to handle this easily: jQuery Address # medar : there is a spacial Header sent with all ajax calls, which can be used as a "logical switch", eg. to exclude header.php from parsing in ajax call: if(empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
require_once $cfg['system_dir'] . '/header.php';
} plugins can use the same technique to modiffy the output as required Most, well designed PHP frameworks, utilizes "heplers" to package and abstract JavaScript behaviors into small PHP functions. To use it you dont even need to know JavaScript. echo javascript_tag(
remote_function(array(
'update' => 'myDivId',
'url' => sed_url('users', 'm=edit&id='.$urr['user_id']),
))
); The helpers deal with browser consistency, complex limit cases, extensibility, and so on, so the amount of JavaScript code they contain can be quite impressive. They also create an abstraction layer over a JavaScript library you are currently using. So it's possible to switch to YUI instead of jQuery without modiffing a single line in your plugin. Perl - the only language that looks the same before and after RSA encryption.
|
|
Dit bericht is bewerkt door Orkan (2009-06-15 08:02, 15 jaren ago) |