+2 votes
by (1.3k points)
Can anyone help with a bit of Java code? I want to strip "? name=Darren%20Boyle&email=dreams@search-utopia. com&phone=00000000000" from the URL mydomain. com… and add it to an image link like <a href="mydomain. com<PLUS THE EXTRACTED BIT">" so it looks like <a href="mydomain. com…"> Thanks
Can anyone help with a bit of Java code?

1 Answer

0 votes
by (1.2k points)
Do you mean javascript? I personally use PHP for this type of functionality, so I can’t help you there.  
by (1.3k points)
Hi Alexander, I just need a way to make it work so PHP would be good I think. Thanks for your time
by (1.2k points)
What’s your current technology stack? I’d assume Wordpress?  
by (1.3k points)
@mollescent I'm actually using a LP builder called insty. pages but I would guess the back end is WP as I can import WP sites. I also have the ability to install PHP if it's not there, I have cPanel access
by (1.3k points)
Is there a PHP test string I can use to find out?  
by (1.3k points)
@mollescent Yep, still a bit over my head. I have the code to breakdown the URL parameters and even use the items in a H£ string but I'm having problems appending the string to a link in the form of <a href="mysite. com? THIS STUFF">
by (1.2k points)
Ah, gotcha. Here’s a way: Join two strings: var str1 = "Hello "; var str2 = "world! "; var res = str1. concat(str2); So far, so good. document. write(res); Outputs: “Hello world! ” You could also use . innerHTML (can’t remember the exact usage - will be happy to elaborate once I understand fully)
by (1.2k points)
Will look up more about it while I wait for your reply. I’m certified in JS, but a bit rusty  
by (1.2k points)
This could work. document. getElementById(“anchor-id”). innerHTML = res; Make sure that your <a> tag has an ID - there’s a couple of other methods to do this, but it’ll take me too long to elaborate  Replace the “anchor-id” with whichever ID you’d like the anchor tag to have
by (1.2k points)
Rename the vars as you wish; I just used examples for simplicity
by (1.2k points)
I’ll try to make it even simpler, incase you haven’t figured it out yet  /* var is the info you need appended - here i assume that you have the info concatenated and ready to input in your anchor tag. */ var parameters = “mydomain. com? name=Darren%20Boyle. ”; /* have an empty anchor tag with an ID. (The anchor tag could contain anything, but the contents will be overwritten with innerHTML. Modify your HTML. */ <a id=“dynamic”></a> /* manipulate the DOM and change the value of your anchor tag */ document. getElementById(“dynamic”). innerHTML(parameters); This should work, if I understand your request correctly. I haven’t tested it, since I’m on mobile. Feel free to ask for more info.  
The Search Engine Optimization Group is where you can always find questions, answers, advice, reviews & recommendations from other community members about better strategy on ranking highly for search engine results.
...