PDA

View Full Version : problems with Dynamic Ajax Content



nicmo
03-30-2009, 12:50 AM
1) Dynamic Ajax Content

2) http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Hello, i am trying to use this script but with POST instead of GET. was searching for forums and found some help but the script was a little different and i still cant get it to work. As my JS skill are very limited i would be glad if anyone could help me get this to work.

here is what i changed based on the previous post i found.



page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)


with



page_request.open('POST', url+bustcacheparameter, true);
page_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var pineapple = document.getElementById("form1").elements; // formID needs to be the ID of your form
for(var fl = 0;fl < pineapple.length; fl++) page_request.send(pineapple[i].name + "=" + pineapple[i].value);


mozilla console error gives:
i is not defined

the form id is form1 btw...

cheers

nicmo
03-30-2009, 01:20 PM
lol! stupid bot...

codeexploiter
03-30-2009, 01:35 PM
for(var fl = 0;fl < pineapple.length; fl++) page_request.send(pineapple[i].name + "=" + pineapple[i].value);

It seems that the loop variable used in fl not i

nicmo
03-30-2009, 02:37 PM
yeah i had fixed that, should have updated this, thanks.

For some reason this script only passes one variable, the first to appear, either in get or post... anyone know why ?

nicmo
03-30-2009, 10:55 PM
somewhere along this line, i would think... the url loses the variables



bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()


its the only place i see that builds the url... but like i said i dont know much about js :(

nicmo
03-31-2009, 11:51 AM
trying with the original code, and with GET, i still cant submit a form using GET and get the variables...

for example:



<a href="javascript:ajaxpage(rootdomain+'/page.php?age=16&name=oli', 'mydiv');">send info</a>


works fine and send the variables BUT with



<form name="form1" id="form1" method="get" action="javascript:ajaxpage(rootdomain+'/page.php', 'mydiv');">
<input type="hidden" name="age" id="age" value="16">
<input name="name" type="text" id="name" value="oli" size="10" maxlength="10">
<input name="button" type="submit" id="button" value="send info">
</form>


the DD code will not get the variables.
Please help me, i have alot of stuff done and everything is only waiting on this :(

nicmo
03-31-2009, 04:37 PM
searching the forums a little more i found more people with the same issue and unresolved. I think this is a big limitation on this script and would be nice to fix it and update it on the website.

Links to the other posts:
http://www.dynamicdrive.com/forums/showthread.php?t=38195
http://www.dynamicdrive.com/forums/showthread.php?t=21704
http://www.dynamicdrive.com/forums/showthread.php?p=173047

nicmo
04-01-2009, 01:04 PM
i have put everything together outside my project just so that you guys can check it out, live.

http://www.bulletdrive.com/ajaxtest/


the external.php code:



<?

$refresh = $_GET["refresh"];
$text = $_GET["text"];

print_r($_GET);

?>