PDA

View Full Version : cannot update div with getUpdateManager



kuzynpiy
24 Oct 2006, 12:31 PM
Hello

I use:

var myDiv = getEl('myDiv');
myDiv.getUpdateManager().update('http://google.com');
and receive Script Error with detail:
Error: 4
Description: No permission.

I use IE 6 and open the site localy from disc. I also include all YUI and Ext js files. Please help me - I'm going mad about it.

Peter

kuzynpiy
24 Oct 2006, 12:55 PM
Hello

I've got the solution. When I upload the file on serwe it goes all right, but only if I call the page on the same server. So http://google.com site will never appear.

Peter

KuN
24 Oct 2006, 1:48 PM
it's not Jack's mistake. it's ajax thing. ajax opens only pages from server you'r on

24 Oct 2006, 2:29 PM
yeah i believe that is a security thing. Local domains only.

jbowman
24 Oct 2006, 4:52 PM
This is where backend code comes into play.

You could do something like -

Javascript


var myDiv = getEl('myDiv');
myDiv.getUpdateManager().update('get_google.php');


get_google.php


return file('http://google.com');


Little security note... I wouldn't do something where you pass the url to the backend script using javascript, rather, I'd at least make sure you hardcode the root of the domain you're pulling from.

jack.slocum
24 Oct 2006, 5:53 PM
Like everyone said, you ran into a standard Ajax security limitations:

- It can't talk to the local file system.
- It can only talk to the server that the html page came from.

As jbowman suggested, you can proxy calls on the local server. Another solution is to use iframes instead of XHR.

bacuz
30 Nov 2007, 2:47 AM
This is my code:

I have a div:

<div id="main"></div>

And I have a linkmenu:

<a onClick="loadDoc('AddUserServlet');">Add User</a></div>\n";

Tree Div:

<div id="tree-div" ></div>


loadDoc : function(url){
Ext.get('main').dom.src = url;
alert(url);
var el = Ext.get("main");
var mgr = el.getUpdateManager();
mgr.update(url);
}

I have same problem, cannot update div with getUpdateManager.
But a litle different with the problem before.
In my case, the file servlet (AddUserServlet) should be contain treePanel.
Then when i have click on the linkmenu, i didn't get the tree. I just get the div without any content. Please someone help me to solve this problem.

Thank you.