Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   XSL - XML - RSS Forums > Programming and XML > Ajax and XML

Tags:



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-03-2008, 04:19 PM
dfmatt
 
Posts: n/a

Default Spry XML data set and dynamic post variables



Hi,

I am trying to create an XML data set that has dynamic post variables.

Everytime something is pressed on the page a variable changes and I then want
to reload the XML data set using the new variable.

I know I can just pull in an XML with all possible variables and filter client
side but this would make it way too large.

Does anyone know what I may need to do.

I tried this:
var myVar = 0;
var dss = new Spry.Data.XMLDataSet ( '../../cgi-bin/server_details.pl' ,
'top' , { method: 'POST' , postData: sid=ajaja21&ip=127.0.0.1&cid=' . myVar ,
subPaths: [ "auth" , "plugins" , "plugins/plugin" ] , keepSorted: "true",
sortOnLoad: "plugins/plugin/order", sortOrderOnLoad: "descending", useCache:
false, loadInterval: 10000 } );

onclick="myVar=1";

But the script doesn't understand the post variables sent (it does when I
remove the . myVar part and put in a static value). I think it isn't sending
that dynamic variable with the post variables.

Any ideas anyone?

Thanks

Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-03-2008, 05:03 PM
V1 Fusion
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

In javascript you need to the + sign to "attach" variables to a string

like:

var world = 0;
var data = 'hello ' + world;

also, if you do the onclick myVar =1 it would only set the myVar to 1 but it
will not invoke any actions for Spry. You should do a dss.setURL('link'); and a
dss.loadData(); after it.

Reply With Quote
  #3 (permalink)  
Old 12-03-2008, 05:03 PM
dfmatt
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

Thanks for the reply.

I had tried that with the following
&cid"+myServer
as well as
&cid+myServer"

but both of them broke Spry causing it to give me an error about failing to
retrieve another of my data sets (this is the error it always gives me when I
break something generic).

Any ideas?

Reply With Quote
  #4 (permalink)  
Old 12-03-2008, 05:52 PM
V1 Fusion
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

Strings start and end with a ''

so &cid"+variable

will still be wrong.. Try this as your constructor:

var dss = new Spry.Data.XMLDataSet ( '../../cgi-bin/server_details.pl' , 'top'
, { method: 'POST' , postData:'sid=ajaja21&ip=127.0.0.1&cid='+myVar , subPaths:
[ "auth" , "plugins" , "plugins/plugin" ] , keepSorted: "true", sortOnLoad:
"plugins/plugin/order", sortOrderOnLoad: "descending", useCache: false,
loadInterval: 10000 } );

Reply With Quote
  #5 (permalink)  
Old 12-03-2008, 05:52 PM
dfmatt
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

That is giving me the same error as before.
Reply With Quote
  #6 (permalink)  
Old 12-03-2008, 05:52 PM
V1 Fusion
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

Than something else must be the issue, do you have a online url?
Reply With Quote
  #7 (permalink)  
Old 12-03-2008, 05:52 PM
V1 Fusion
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

Than something else must be the issue, do you have a online url?
Reply With Quote
  #8 (permalink)  
Old 12-03-2008, 05:52 PM
dfmatt
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

No but I can give you more source code.

I sent it as a PM (too long for message box)
Reply With Quote
  #9 (permalink)  
Old 12-03-2008, 05:52 PM
dfmatt
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

No but I can give you more source code.

I sent it as a PM (too long for message box)
Reply With Quote
  #10 (permalink)  
Old 12-03-2008, 05:52 PM
V1 Fusion
 
Posts: n/a

Default Re: Spry XML data set and dynamic post variables

can you email it to me? hello@3rd-Eden.com

The PM won't open, the window just stays white
Reply With Quote
Reply


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

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



Contact Us -|- XSL - XML - RSS Forums -|- Archive -|- Top -|-Rules/Disclaimer-|-Help/Support -|-Advertise
© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
All times are GMT. The time now is 01:18 PM.
Style Developed by Epic Designz