Can I Pass a Resource through Function? OR Can I Send Various Variables to Another Function as a Resource?

Can I Pass a Resource through Function? OR Can I Send Various Variables to Another Function as a Resource?

I am not an experienced developer with JQuery/Javascript. Currently I am having an issue maintaining same contents through out various processes without querying database again and again. With JQuery/Javascript, I am sure this is easy although I do not know the best way of doing it. Below is an example of what I want: 

//SCRIPT 1

//......Get  some data from database eg:

var fname = "Donald";
var lname = "Trump";
var user_id = 1;
var address = "White House";

resource = fname, lname, user_id, address;

<a href="#" onclick="view('+resource+');">Post</a>

//END SCRIPT 1

--------------------------------------------------------------------------------------

//SCRIPT 2
// ....................Now on receiving function, can I do something like this?
function view(resource) {

$fname = resource.fname;
$lname = resource.lname;
$address = resource.address;
$user_id = resource.user_id;

}