Chris Cummings
Chris Cummings

Reputation: 1548

Reload form in dialog box without page reload

I have a wordpress page that is using a modal (jQuery UI Dialog) window with a form in it. The modal works fine, however it has a form in the window with this form tag (content is loaded from a DIV):

<form id="inline_ddateform" onSubmit="javascript: return pCalc(this);">

When the form is submitted the main page reloads and the variables are coming back in the main site URL.

Before form submit: www.site.com

After form submit: www.site.com?m=4&c=8

How can I bring the variables into the form in the modal with the values that JS is returning? It's needed to display some info in the modal.

Upvotes: 0

Views: 582

Answers (1)

user3413723
user3413723

Reputation: 12233

Use the function here: http://papermashup.com/read-url-get-variables-withjavascript/

It has a function that gets url variables for you. Copy it into your project then use like so:

var variables = getUrlVars()

var m = variables["m"]

alert(m);

Then you can use that where you like.

Upvotes: 1

Related Questions