| Forum |
|
|||||||
| Open Source A place where you can talk to like-minded people about the fastest growing software movement today! Discuss anything and everything about Open Source software and Operating Systems. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Apprentice
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
|
i had made 1 web service which returns the html containing <script>alert('hello')</script> after getting response from server i had assigned the responseText to one div's innerHTML but it not working so how can i use this script to work it out. i need it for 1 application which registers the images in dragable content, so if no way to run this script in this way then is there any way to make it?? Thanks in advance..
__________________
If you want the best, you have to vote for the best V.I.P.U.L.:= Vigilant Individual Programmed for Ultimate Learning |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#3 (permalink) | |
|
Apprentice
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
|
Quote:
Code:
var imagePath="../../Common/Images/Icons/bar.gif";
var http_request = false;
var resid;
var lid;
function makeRequest(url,param,type,loading,result)
//makeRequest("http://xyz.com","name=abc","POST/GET","LoadId","ResId")
{
resid=result;
lid=loading;
document.getElementById(lid).innerHTML="Loading...<br><img src='" + imagePath + "'><br>";
if (window.XMLHttpRequest)
{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser not support XMLHTTPRequest.");
}
http_request.onreadystatechange = alertContents;
http_request.open(type, url);
http_request.setRequestHeader("Host","localhost");
http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http_request.send(param);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200)
{
document.getElementById(resid).innerHTML='';
document.getElementById(resid).innerHTML=http_request.responseText;
document.getElementById(lid).innerHTML="";
} else {
alert('There was a problem with the request.');
document.getElementById(lid).innerHTML="";
}
}
}
just response.write("<script>alert('Hello')</script>") but it prints <script>alert('Hello')</script> in given DIV not the script itself Thanks
__________________
If you want the best, you have to vote for the best V.I.P.U.L.:= Vigilant Individual Programmed for Ultimate Learning |
|
|
|
|
|
#4 (permalink) |
|
In Pursuit of "Happyness"
Join Date: May 2005
Location: New Delhi
Posts: 3,404
|
The document.getElementById() takes in a string as a paramater..
So it should be document.getElementById("resid").innerHTML=''; Notice the quotes? |
|
|
|
|
#5 (permalink) | |
|
Apprentice
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
|
Quote:
i had just used script.aculo.us its gr8 man........ it works 4 me................... btw Thanks..
__________________
If you want the best, you have to vote for the best V.I.P.U.L.:= Vigilant Individual Programmed for Ultimate Learning |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|