I'm using the Wordpress Contact Form 7, setting a Cookie refurl using the Cookie Monster plugin. Using these tools (or any other), what is the easiest way to set a cookie that captures the referring URL and then adds this to a hidden field in a Contact Us form?
问问题
753 次
1 回答
1
With the cookie plugin.
Let's say that the cookie is called "refurl"
You can access it using:
var refURL = $.cookie("test");
You can append an element to your form by selecting it and adding the input to it. Let's say the id
of your form is ContactUsForm
:
var $el = $("<input />").attr("type","hidden").attr("value",refURL);
$("#ContactUsForm").append($el);
于 2013-03-31T02:24:41.587 回答