Plugin

Developer
Supported

GET and POST Variables

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

Can this be used with ajax?

General

Amit
Amit

Hi,

I would like to see a full example with this plugin before investing. Could you show me an example with ajax where upon form submission, certain actions happen?

This add-on seems very interesting but also, is it safe to pass variables like that in the system?

Laisvunas
# 1
Developer
Laisvunas

Hi Amit,

It surely can be used with AJAX. See this demo where this plugin is being used (If you are interested in code of this demo see here at the bottom).

The use of this plugin is sage because outputted values are sanitized using ExpressionEngine’s xss_clean function.

Amit
# 2
Amit

Am confused. This is an example from the commenters plugin. I saw the part of the code that was part of the ajax example but could not relate it to say how a simple form submit would work.

Will take another look. Better documentation of GET and POST Variables add-on would definitely prove its value to newbies like me.

Laisvunas
# 3
Developer
Laisvunas

If you need simple demo, see this one.

Amit
# 4
Amit

Ok - This is making more sense now - Can you just show me the code for the form + EE tags? I think I’ll get it

Laisvunas
# 5
Developer
Laisvunas

The code of the page containing form:

<html>
<
head>

<
title>GET and POST Variables plugin's demo</title>

</head>

<body>

<h1>GET and POST Variables plugin'
s demo</h1>

<
p>
Type any string and submit the formThe string (the value of variable "my_variable"will be outputted using the tag exp:get_post_vars in the page that will load after submission.
</
p>

<
form action="{homepage}/technical/demo/get_and_post_variables_plugin_demo2/" method="post">

<
textarea name="my_variable" rows="15" cols="48">

</
textarea>

<
p><input type="submit" name="submit" value="Submit" /></p>

</
form>

</
body>
</
html

The code of the page that loads after the form has been submitted:

<html>
<
head>

<
title>GET and POST Variables plugin's demo</title>

</head>

<body>

<h1>GET and POST Variables plugin'
s demo</h1>

<
p>
The variable "my_variable" has the value{exp:get_post_vars}{post_my_variable}{/exp:get_post_vars}
</p>

<
a    nclick="history.go(-1)">Back</a>

</
body>
</
html
Amit
# 6
Amit

Great - Got it - Thanks!

casey
# 7
casey

Is is possible to use this in another EE form tag like freeform or {exp:member:login_form}?
I’m having problems just trying to make a simple sticky form..

<input class="txtinp {required:true}" name="email" type="text" value="{exp:get_post_vars}{post_email}{/exp:get_post_vars}" />