LaurenWilson Posted August 28, 2013 Share Posted August 28, 2013 I'm doing my first ever website and have found this site to be a fantastic resource. I've got to a step now that I thought would be really easy but is apparently rather complex. I need images in Zoo Effects Galleriffic Gallery to to take the user to a page where they have to input their name and email address before downloading an attached specification. I am using WordPress with the theme Masterful Business (by PandaThemes) which has a jQuery processor. I'm told I need to write the command into the jQuery, however I have no idea how to do this or where to insert the information that I found to do it? can anybody help me out by explaining it in simple terms please? I've found this information, I just need the hows and whats! function post(url, params, urlEncoded, newWindow) {var form = $('<form />').hide();form.attr('action', url).attr('method', 'POST').attr('enctype', urlEncoded ? 'application/x-www-form-urlencoded' : 'multipart/form-data');if(newWindow) form.attr('target', '_blank');function addParam(name, value, parent) {var fullname = (parent.length > 0 ? (parent + '[' + name + ]') : name);if(value instanceof Object) {for(var i in value) {addParam(i, value[i], fullname);}}else $('<input type="hidden" />').attr({name: fullname, value: value}).appendTo(form);};addParam('', params, '');$('body').append(form);form.submit();} Thanks, Lauren Link to comment Share on other sites More sharing options...
justsomeguy Posted August 28, 2013 Share Posted August 28, 2013 Which parts of that process do you have working now, and what still needs to be done? It looks like that code is a function that will add parameters to a form and submit it. Link to comment Share on other sites More sharing options...
LaurenWilson Posted August 29, 2013 Author Share Posted August 29, 2013 I haven't implemented any of the process yet...i'm too scared of breaking something. Apparently I need to do this and then redirect the form to the download...what do you think? Link to comment Share on other sites More sharing options...
thescientist Posted August 29, 2013 Share Posted August 29, 2013 chances are you will break a lot of things until you get it right. at least make a copy of the file and then start working on it, so we can help you out. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 29, 2013 Share Posted August 29, 2013 Yeah, I wouldn't suggest making changes to the live site until it's finished and tested. Make a copy that you can work on, even if it's just a few files. I'm not familiar with most of the specific software that you're using, but it sounds like these are the basic steps: Attach click events on the images, if they aren't already there, to either go to a new page with the form on it or display the form in a lightbox or however you want that to show up. The form would have fields for name and address, and it needs to submit to a PHP page to process the form. There are a few options to choose from there. One option is to submit the form via ajax, and the form would process the input data (you haven't mentioned what you want to do with the name and email address), and then it would either output an error message if there was a problem, or it would output the URL of the file they are trying to download. The ajax response handler would need to be able to detect if it got an error message or URL back, and either display the error message or redirect to the URL. The other option is to submit the form normally without ajax, and the form processor would again validate the data, and either show the form again with error messages or redirect to the URL to download. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now