Why do we pass null to XMLHttpRequest.send?

If you’ll take a look at an old specification of XMLHttpRequest, it seems like as though the W3C did not require that the parameter be optional at one point, which may have led to people supplying an explicit null value ‘just in case’. (search for ‘SHOULD support the send’) http://web.archive.org/web/20060409155734/http://www.w3.org/TR/XMLHttpRequest/ Another plausible reason I’ve come … Read more

anti-CSRF token and Javascript

There are several techniques, which when used together provide a sufficient CSRF protection. Unique Token A single, session-specific token is good enough for most applications. Just make sure that your site doesn’t have any XSS vulnerabilities, otherwise any kind of token technique you employ is a waste. AJAX call to regenerate the token is a … Read more

JS/jQuery get HTTPRequest request headers?

If this is for debugging purposes then you can just use Firebug or Chrome Developer Tools (and whatever the feature is called in IE) to examine the network traffic from your browser to the server. An alternative would be to use something like this script: $.ajax({ url: ‘someurl’, headers:{‘foo’:’bar’}, complete: function() { alert(this.headers.foo); } }); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)