Character in Ajax layer and more...?

Discussion in 'HTML & Website Design' started by 123GoToAndPlay, Jun 11, 2008.

  1. #1
    Hi there,

    I am using a simple ajax function which i call like
    makeRequest('/content.php?nav=help','content');


    
        function makeRequest(url,layerName) {
            var http_request = false;
    
            if (window.XMLHttpRequest) { // Mozilla, Safari, ...
                http_request = new XMLHttpRequest();
                if (http_request.overrideMimeType) {
                    http_request.overrideMimeType('text/xml');
                    // See note below about this line
                }
            } else if (window.ActiveXObject) { // IE
                try {
                    http_request = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) {}
                }
            }
    
            if (!http_request) {
                alert('Giving up :( Cannot create an XMLHTTP instance');
                return false;
            }
            http_request.onreadystatechange = function() { 
    		//alertContents(http_request); 
    		output(http_request,layerName);
    		};
            http_request.open('GET', url, true);
            http_request.send(null);
    
        }
    
    
    
    		function output(http_request,layerName) {
    if (http_request.readyState == 4) {
    			//Set the contents of our span element to the result of the asyncronous call.
    				 if (http_request.status == 200) {
    					document.getElementById(layerName).innerHTML = http_request.responseText;
    etc.
    
    
    Code (markup):
    but this
    
    man - woman
    
    Code (markup):
    gives me
    
    man ? woman
    
    Code (markup):
    in the ajax layer

    1/ How do i fix this character issue?

    2/ Furthermore how do i use swfobject when it's needed?
     
    123GoToAndPlay, Jun 11, 2008 IP