javascript - Session cookies not persisting on local page, remote server? -



javascript - Session cookies not persisting on local page, remote server? -

i have page on local computer script interacts remote server. every request, gets different phpsessid value. have page not beingness associated domain? there way solve this, perhaps maybe manually setting phpsessid or in php.ini?

look, don't know downvotes coming or request close, either. seems trolling me. not coding error. server error. code nothing. seriously, plain , standard can be, like:

$.post('http://example.com/server.php',{'stuff':'data'},function(){ }); // phpsessid 545ty789gh78rhr

then, when phone call again:

$.post('http://example.com/server.php',{'stuff2':'data'},function(){ }); // phpsessid fnunurhf894fh

and then, on php page:

session_start(); if(isset($_post['stuff']) $_session['variable'] = '123'; if(isset($_post['stuff2']) echo $_session['variable']; // returns nothing, phpsessid cookie value has changed

thus, i'm thinking it's either in php.ini or has how php handles session cookies no http domain (just local script accessing server). i'm wondering if there's in php.ini solve or perhaps if there's way manually set phpsessid's (if there's no way through php.ini).

i think issue cookies stored on per domain level. browser operating on localhost, , server operating on example.com. when first ajax request made, browser gathers localhost cookies , sends them along. server finds no example.com phpsessid cookie, creates 1 , starts new session. when request comes browser cookie set example.com. when sec request made browser looks cookies has localhost, finds none, , repeats process.

cross domain ajax requests not allowed default. may able solve problem trying jsonp request. see jquery's documentation more info.

javascript php

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -