Forum     

Go Back   Digit Technology Discussion Forum > Software > Open Source
Register FAQ Calendar Mark Forums Read

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.

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 17-01-2007, 07:02 PM   #1 (permalink)
Apprentice
 
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
Question Help me to solve this AJAX problem

Hello friends,

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
vipul is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 18-01-2007, 07:47 AM   #2 (permalink)
In Pursuit of "Happyness"
 
kalpik's Avatar
 
Join Date: May 2005
Location: New Delhi
Posts: 3,404
Default Re: Help me to solve this AJAX problem

Umm.. i have VERY little knowledge of AJAX so dunno if i would be able to help you.. But it could help if you would post some more code
kalpik is offline  
Old 18-01-2007, 10:58 AM   #3 (permalink)
Apprentice
 
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
Default Re: Help me to solve this AJAX problem

Quote:
Originally Posted by kalpik
Umm.. i have VERY little knowledge of AJAX so dunno if i would be able to help you.. But it could help if you would post some more code
this is the AJAX.js file which going to make request:
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="";
           }
       }
       }
and in response

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
vipul is offline  
Old 18-01-2007, 07:43 PM   #4 (permalink)
In Pursuit of "Happyness"
 
kalpik's Avatar
 
Join Date: May 2005
Location: New Delhi
Posts: 3,404
Default Re: Help me to solve this AJAX problem

The document.getElementById() takes in a string as a paramater..
So it should be document.getElementById("resid").innerHTML='';
Notice the quotes?
kalpik is offline  
Old 19-01-2007, 12:19 PM   #5 (permalink)
Apprentice
 
Join Date: Oct 2004
Location: Ahmedabad,gujarat
Posts: 60
Default Re: Help me to solve this AJAX problem

Quote:
Originally Posted by kalpik
The document.getElementById() takes in a string as a paramater..
So it should be document.getElementById("resid").innerHTML='';
Notice the quotes?
Yeah........ i done it...................



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
vipul is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 10:24 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2