-function getTitle(input, response){
- var title = document.getElementById('titleField');
- if (title.value == '') {
- title.style.backgroundImage = 'url(<?php echo $root; ?>loading.gif)';
- if (response != null) {
- title.style.backgroundImage = 'none';
- title.value = response;
- } else if (input.indexOf('http') > -1) {
- loadXMLDoc('<?php echo $root; ?>ajaxGetTitle.php?url=' + input);
- } else {
- return false;
- }
- }
-}
-
-var xmlhttp;
-function loadXMLDoc(url) {
- // Native
- if (window.XMLHttpRequest) {
- xmlhttp = new XMLHttpRequest();
- xmlhttp.onreadystatechange = processStateChange;
- xmlhttp.open("GET", url, true);
- xmlhttp.send(null);
- // ActiveX
- } else if (window.ActiveXObject) {
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- if (xmlhttp) {
- xmlhttp.onreadystatechange = processStateChange;
- xmlhttp.open("GET", url, true);
- xmlhttp.send();
- }
+function getTitle(input) {
+ var title = $("#titleField").val();
+ if (title.length < 1) {
+ $("#titleField").css("background-image", "url(<?php echo $root; ?>loading.gif)");
+ if (input.indexOf("http") > -1) {
+ $.get("<?php echo $root; ?>ajaxGetTitle.php?url=" + input, function(data) {
+ $("#titleField").css("background-image", "none")
+ .val(data);
+ });