Hello, I can't figure out how to pass the values from dojo to a new php page. This is the meat of the dojo code that I did not write, I don't know dojo. I have another page that includes libraries and has the code that creates a form for all of this code below. Everything works fine. What I need to do is pass the values of these variables to a new php page so I can use them to query the database. I want click on an image and then have these values ready to pass onto some php and mysql.
****Heres the values I need
var get;
get = {
"url":"services/history.service.php",
"handleAs":"json",
"content":{
"system":system,
"adminuser_id":adminuser_id,
"from_date":from_date,
"to_date":to_date,
"from_time":from_time,
"to_time":to_time,
"page":page
},
****Heres the function that changes the values on the fly
function refreshHistory(system, adminuser_id, from_date, to_date, from_time, to_time, page)
{
var get;
get = {
"url":"services/history.service.php",
"handleAs":"json",
"content":{
"system":system,
"adminuser_id":adminuser_id,
"from_date":from_date,
"to_date":to_date,
"from_time":from_time,
"to_time":to_time,
"page":page
},
"load":function(data){
console.log(data);
dojo.destroy(dojo.byId("data_tbody"));
var table = dojo.create("tbody", {
"id":"data_tbody"
}, dojo.byId("table_data"));
if(data.length == 1)
{
var tr = dojo.create("tr", {
"class":"odd"
},table);
dojo.create("td", null, tr);
dojo.create("td", null, tr);
dojo.create("td", null, tr);
dojo.create("td", {
"innerHTML":"No Results"
}, tr);
dojo.create("td", null, tr);
dojo.create("td", null, tr);
dojo.create("td", null, tr);
}
dojo.forEach(data, function(entry, n){
if(entry.hasOwnProperty("pages"))
{
dojo.destroy(dojo.byId("ID_pages"));
var select = dojo.create("select", {
"name":"pages",
"id":"ID_pages",
"onchange":function() {
refreshHistory(
dijit.byId('ID_system').get('value'),
dijit.byId('ID_adminuser').get('value'),
dojo.byId('search_date_from').value,
dojo.byId('search_date_to').value,
dojo.byId('search_time_from').value,
dojo.byId('search_time_to').value,
dojo.byId('ID_pages').options[dojo.byId('ID_pages').selectedIndex].value
);
}
}, dojo.byId("mySpacer"));
if(entry.pages == 0)
{
dojo.create("option", {
"value":0,
"innerHTML":0
}, select);
}
for(i=1;i<=entry.pages;i++)
{
if(i == entry.current_page)
{
dojo.create("option", {
"value":i,
"innerHTML":i,
"selected":"selected"
}, select);
}
else
{
dojo.create("option", {
"value":i,
"innerHTML":i
}, select);
}
}
return;
}
if(n%2)
{
var tr = dojo.create("tr", {
"class":"even"
},table);
}
else
{
var tr = dojo.create("tr", {
"class":"odd"
},table);
}
dojo.create("td", {
"innerHTML":entry.history_table
}, tr);
dojo.create("td", {
"innerHTML":entry.history_table_id
}, tr);
dojo.create("td", {
"innerHTML":entry.history_field
}, tr);
if(entry.history_oldvalue.length >= 40)
{
dojo.create("td", {
"innerHTML":entry.history_oldvalue.substring(0, 40)+"...",
"holdvalue":entry.history_oldvalue,
"id":"oldvalue_"+Math.random()*55,
"onclick":function()
{
console.log(dojo.attr(dojo.byId(this.id), "holdvalue"));
var dialog = new dijit.Dialog({
"title":"Large Value",
"content":dojo.attr(dojo.byId(this.id), "holdvalue")
}).show();
}
}, tr);
}
else
{
dojo.create("td", {
"innerHTML":entry.history_oldvalue
}, tr);
}
if(entry.history_newvalue.length >= 40)
{
dojo.create("td", {
"innerHTML":entry.history_newvalue.substring(0, 40)+"...",
"holdvalue":entry.history_newvalue,
"id":"newvalue_"+Math.random()*55,
"onclick":function()
{
console.log(dojo.attr(dojo.byId(this.id), "holdvalue"));
var dialog = new dijit.Dialog({
"title":"Large Value",
"content":dojo.attr(dojo.byId(this.id), "holdvalue")
}).show();
}
}, tr);
}
else
{
dojo.create("td", {
"innerHTML":entry.history_newvalue
}, tr);
}
dojo.create("td", {
"innerHTML":entry.historyadminuser_name
}, tr);
var tmp = new Date(entry.history_timechanged * 1000);
var mmToMonth = new Array("January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var mm = mmToMonth[tmp.getMonth()];
var ap = "AM";
var mins = tmp.getMinutes();
if(mins < 10) { mins = "0" + mins; }
//if(tmp.getHours() > 11) { ap = "PM"; }
var hrs = tmp.getHours();
if( hrs > 11) { ap = "PM"; }
if( hrs > 12) { hrs = hrs - 12; }
var datetime = mm+" "+tmp.getDate()+", "+tmp.getFullYear()+"<br/>"+hrs+":"+mins+" "+ap;
dojo.create("td", {
"innerHTML":datetime
}, tr);
});
},
"error":function(error){
console.log(error);
}
};
dojo.xhrGet(get);
}
Thank you to all that helps!!!