I recently had to disable some forms if a certain case existed and I came up with a hilarious way to use the same code for PHP and Javascript. Sometimes, amusing myself is how I get through a day.
First the PHP:
Simple, right?
Now for the Javascript (with a little help from jQuery):
var $_POST = 'post';
function unset(type) {
$('form[method='+type+']').bind('submit', function(){ return false; });
}
$(function(){
unset($_POST);
});
function unset(type) {
$('form[method='+type+']').bind('submit', function(){ return false; });
}
$(function(){
unset($_POST);
});
Okay, it takes a little more effort and “unset” is a horrible function name for what it’s doing. But it’s worth it, right? Right?!
You need to submit this to php.js immediately.
蛋疼的文章。。。
The comment above translates (via Google Translate) to “Egg pain article…”. I’m pretty sure that’s an insult.
Nice, Steve.
[...] myself is how I get through a day. First the PHP: unset($_POST); Simple, right? Now… [full post] Jared MLNTN javascriptphp 0 0 0 0 0 [02 Dec [...]