javascript - JS/jQuery passing array/variable/data to PHP in same page? -


im hoping can point me in right direction.

i have php page, includes html markup , js/jquery routines build array of 'user choices' based on 'user input' (checkboxes..etc).

my question is, how can pass off (multidimensional) array php, in same page? (ultimately want save data/array php session)

while looking around, read using (external) .php script do,, not im after, i'm hoping same page i'm in... without refresh.

will $.post() me? without page refresh (if suppress event or whatever)... , -not- using external .php script?

i understand php runs/executes first... else..
i'm not trying php data being sent js/ajax.. outside of save session array..

ajax seems needed?

to summarize:

  • 1.) php , js in/on same page (file)
  • 2.) no page refresh
  • 3.) no external php script 'anything'.
  • 4.) trying (multidimensional) array php session in same page.
  • 5.) trying 'update' php session array each time user 'clicks' on checkbox.

i have read little on using ajax post same page url var left empty/blank?

edit:

to show data, want pass...heres snippet of code.

its array of objects.. 1 of poperties of each object array

example:

var somepicks = [];  somepicks.push({casename:casename, fullname:fullname, trialdate:trialdate, citystate:citystate, plaintiff:plaintiff, itemsordered:itemsordered=[{name:itemordered, price:itemprice}]}); 

when checkboxes.. update 'sub-array' (push or splice..etc)

somepicks[i].itemsordered.push({name:itemordered, price:itemprice});  

'this' array/data want php session js using whatever can ajax likely.

you can sort of that, in essence won't different using external php file. php code gets executed on server before ever being sent browser. won't able update php session array without reconnecting server.

if want use post call current page (i don't think can leave url blank, can provide current file name), can have php handler code @ top of page. however, exact same putting handler code in external file , calling it.

either way, page not refresh , same user.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -