I’ve been trying to find a way to do this but, have not found many resources that specifically relate to this situation.
I need a javascript (can make use of Jquery if need be) to swap phone numbers on a site.
-
2 numbers would be specified. One would show on the site by default.
-
The script needs to be able to create a cookie and do this by recognizing a value in the URL string.
For Example: http://www.site.com/index.html?value=
‘?value=‘ would be the value.
This URL (with the additional variable) would bring the user to the same site but, the variable in the string would set the cookie and display a different number. The default number would not be displayed again until the cookies were removed.
Due to the situation with my server, I cannot make use of PHP ( I know, that would make things alot easier 😛 )
Any help would be greatly appreciated.
UPDATED
DEMO:
GO here: http://jsbin.com/imawo4/85
THEN here: http://jsbin.com/imawo4/85/?value=john
include the jQuery Cookie Plugin
then use this:
HANDLE URL PARAMETER
MAIN CODE
HTML PART
This should work as expected! 😉