Find Jobs
Hire Freelancers

php and js Session Variable

$10-30 USD

Closed
Posted about 5 years ago

$10-30 USD

Paid on delivery
Simple project for those who know php to js.. THIS WORKS .................... var parameters = { serveraddress: '[login to view URL]', // Manual manipulation works username: 'testuser', // Manual manipulation works password: '00e2ac36b356df4616b6ecb6', // Manual manipulation works loglevel: 5 }; THIS Fails ....................I need this to be dynamic and get the username from the php session variable... var parameters = { var sesstest = "<?php echo $_SESSION['username']; ?>"; // This is a Session variable -- I can see username and echo it in php. serveraddress: '[login to view URL]', username: sesstest, // This fails. If I place it in single quotes = fail. Double quotes = fail. And + var + fails. password: '00e2ac36b356df4616b6ecb6', loglevel: 5 }; In my php I have: <script type="text/javascript"> var sesstest='<?php echo $_SESSION['username'];?>'; </script> before the scrip source of the js loads. How do I get session variables into js and what is the proper format for js colon :
Project ID: 19054722

About the project

6 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
6 freelancers are bidding on average $28 USD for this job
User Avatar
Nice to meet you. I've read the project description and can develop definitely. I'll provide you with the highly skilled & professional HTML/CSS, PHP/WordPress/CodeIgniter, JavaScript, MySQL, front & back-end web development services and complete the site in time. Please contact with me. Thank you very much.
$25 USD in 1 day
4.9 (131 reviews)
7.0
7.0
User Avatar
Hello, I'm Abu Gosia. I'm interesting your project very well. I m quite well experienced in these jobs. Let's go ahead with me. Thanks
$15 USD in 0 day
4.8 (233 reviews)
7.0
7.0
User Avatar
Hello I'm the full stack developer. I understood all about your job. so there is no problem for me to complete your project with my skill. I can do work your job perfectly. Hope to work with you as soon as possible. Best regards
$25 USD in 1 day
4.9 (71 reviews)
5.9
5.9
User Avatar
Good I will solve the problem from now in here. you have saved the username as session variable. you can enter the session variable into <input type="hidden"... value="..."> That's all. You can get the username in javascript using "hidden" above.
$20 USD in 1 day
4.5 (60 reviews)
5.6
5.6
User Avatar
Hello Sir, I have gone through your requirements and will be able to fix your issue asap. I have 5+ years of experience in PHP and all it's supportive languages like JS, HTML, CSS, Bootstrap etc. Let discuss on chat for more details.. Thanks
$20 USD in 1 day
4.9 (32 reviews)
5.0
5.0

About the client

Flag of UNITED STATES
Biloxi, United States
5.0
10
Payment method verified
Member since Nov 2, 2015

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.