javascript - Contact Form - Append ".html" from URL after POST -


there may bit more this, haven't been able figure out.

what have contact form on multiple pages post same "thankyou.html" page. exception of index file, every other page has ".html" extension end of name makes form cannot redirect correct page after form post.

example: user fills out form > form post > redirects url below

url of current form post: http://www.example.com/sub-domain.html/thankyou.html?(query parameters)

what want url redirect as: http://www.example.com/sub-domain/thankyou.html?(query parameters)

i pull in url parameters require using geturlvars

so main question is.

how can append ".html" variable subdomain form can post thankyou.html page?

    // pulls in url parameters     var subdomain = window.location.pathname;     var variable = geturlvars()["var1"];     var variable2 = geturlvars()["var2"];     $('input[name="xxredir"]').val('http://www.example.com' + subdomain +     '/thankyou?var1=' + variable + "&var2=" + variable2); 

if want strip trailing .html string can use regex , replace it:

var subdomain = window.location.pathname.replace(/\.html$/, ''); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -