May 1, 2012
get the title from a context
Question by Hermione
How Do I select the title of the context? I am suppose to select it to change the title of the page.
var handler = function(context){
document.title = //context's title
....
}
//sample context from ajax request
var context = '<!DOCTYPE html><html>
<head><title>Hello</title></head>
<body>
<a href="#">Click Here</a><p>This is my sentence.</p>
</body></html>';
.ajax{(
...
success: function(data){
handler(data);
}
});
EDIT: I forgot the doctype just incase it’s necessary. The context was from an AJAX Request.