SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member punuhan's Avatar
    Join Date
    Jul 2008
    Location
    Lahore
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AJAX "Permission Denied"

    Hi'
    i m using AJAX following function to take data from a page in javascript. when i search for data in the text box, the error is generated "Permission is denied". Can some on help me?



    Code JavaScript:
    function requestCustomerInfo() {
    		var sId = document.getElementById("search_val").value;
    		top.frames["hiddenFrame"].location = "getcustomerdata.php?id=" + sId;
    		}
    	function displayCustomerInfo(sText) {
    		var divCustomerInfo = document.getElementById("divCustomerInfo");
    		divCustomerInfo.innerHTML = sText;
    		}
    	var xmlHttp;
    	function createXMLHttpRequest() {
    		if (window.ActiveXObject) {
    		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    		}
    		else if (window.XMLHttpRequest) {
    		xmlHttp = new XMLHttpRequest();
    		}
    	}
     
     
    	function onReadyStateChange() {
    		if (xmlHttp.readyState == 4) {
    			if (xmlHttp.status == 200) {
    				var	responseDiv = document.getElementById("responseDiv");
    				responseDiv.innerHTML = "<table width='300' class='NormalText1' cellpadding='0' cellspacing='0'>"+xmlHttp.responseText+"</table>";
     
     
    			}
    		}
    	}
     
     
    	function performSearch () {
    		var searchTerm = document.getElementById("search_val").value;
    		var url = baseUrl + "?searchTerm=" +searchTerm;
    		createXMLHttpRequest();
    		xmlHttp.open("GET",url);
    		xmlHttp.onreadystatechange = onReadyStateChange;
    		xmlHttp.send(null);
     
    	}
    Thankful in advance.
    Last edited by spikeZ; Nov 3, 2008 at 03:46.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    Where is baseUrl defined?

    Define it with an absolute path: http://mysite.com
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Evangelist TommiChi's Avatar
    Join Date
    Oct 2008
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there,

    Can you say on which statement the error is being thrown?

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you trying to do this locally? The security model in some browsers does not allow Ajax to work locally.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  5. #5
    SitePoint Member punuhan's Avatar
    Join Date
    Jul 2008
    Location
    Lahore
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I was facing this problem on online. But it is now fixed by your coordination. The problem was in my baseUrl. The path was incorrect as mentioned by spikeZ.

    So thanks to all of you for your support. Will you provide me link for best learning of AJAX with examples.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •