Avatar of tjyoung

asked on 

Trying to construct a URL using .get and can't get the syntax correct

I'm trying to attache a couple different variables to a url using the code below (just a test url) and I can't figure out how to get it correct?

Here is what I have:
     $('#fetch').html( "Name: " + data.name ); // John
     $('#fetch2').html( "Time: " + data.time ); //  2pm
   }, "json");

Open in new window

That works fine. What I'm trying to append on the url is 2 variables. One is a php variable and the other is from a select value using javascript. I can get the 2 variables fine, just don't know the proper way to string it on to the url.

Here is my guess (which doesn't work but might give you an idea what I'm trying to do)
$.get("test.php?account_id=<?php echo $account_id;?>&campaign_id=$("select[name='contests']").val()},
   and so on...

Open in new window

Any help would be appreciated. Like I said I can get the variables, just don't know how to attach to the url without errors.

Avatar of undefined
Last Comment

8/22/2022 - Mon