.load() with beforeSend action
This works fine:
- $.ajax({
- url: "http://myurl.com",
- dataType: "text",
- beforeSend: function(xhr) {
- xhr.setRequestHeader("Ajax-Request", "true");
- }
- });
However I need to return the results in a div. The only way I've found to do this is to use the load() function.
- $("#div1").load("http://myurl.com");
The above also works but I need to set the request header to preform some different logic. Is there a way to set the request header using the load function?