// JavaScript Document
// C:\myproducts_sites\ow\scripts\presidential.js.php
myDebug.line=1;try{
var script_presidential='js:presidential',presidential_stop=0;
jsscriptslist=jsscriptslist.concat(new Array(script_presidential));
myDebug.checkjsload(script_presidential);
tagfct = ={kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'load: '+script_presidential,kjsstop:presidential_stop};
/*
if(!myApp){
var myApp={};
alert('presidential-d.js, line 4, coco myApp?');
}
*/
function goajaxhtmlcontentforapplication(demand,value,pass_sctappli){
myDebug.line=34;try{
tagfct = ={kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'goajaxhtmlcontentforapplication(demand,value,pass_sctappli)',kjsstop:presidential_stop};
//////alert("ljs:36 presidential.js.php???? "+myDebug.chrrc+"demand: "+demand+myDebug.chrrc+"value: "+value+myDebug.chrrc+"pass_sctappli: "+pass_sctappli);
var urlphp=div=datasform=urlhtml='',isform=false;
var file='updatepageapplication.php';
var divname='tdpopup0';
alert("ljs:41 "+myDebug.chrrc+"pass_sctappli: "+pass_sctappli);
if(pass_sctappli&&pass_sctappli[1]){
isform=true;
/// sctappli='../../../'+pass_sctappli[0];
sctappli='/myproducts_sites/'+pass_sctappli[0];
divname=pass_sctappli[1];
////E:\myproducts_sites\labo\tabber\ow\french_presidential_election_2017\saveaverageapplication.php
if(demand=='saveaverage'){
file='saveaverageapplication.php';isform=false;datasform+='demand='+demand+'&value='+value+'&';
}
else
file='savedatapageapplication.php';
var pass=pass_sctappli;
alert(demand+myDebug.chrrc+file+myDebug.chrrc+value);
}
//===
/// urlphp = sctappli+file;
// C:\myproducts_sites\ow\scripts
sctappli="/myproducts_sites/ow/scripts/";// file=presidential.js.php
////sctappli="";// file=presidential.js.php
urlphp = sctappli+file;
/// urlhtml = '';
////div=$(divname);///$Prot(divname);
div=divname;///$Prot(divname);
myDebug.line=63;
/// tagfct = .kjsparams={'isform':isform,'urlphp':urlphp,'div':div,'divname':divname};
///tagfct = ="".assign(tagfct = ,tagfct = .kjsparams);
////Object.assign(tagfct = ,tagfct = .kjsparams);
///myDebug.line=34;myDebug.debug_view_e_catch('',tagfct = );
//===
// alert("ljs:52 "+myDebug.chrrc+"!isform: "+!isform+myDebug.chrrc+"sctappli: "+sctappli+myDebug.chrrc+"file: "+file+myDebug.chrrc+"div: "+div);
if(!isform){
if(div)div.innerHTML = '';///'
Loading... '+'[' + 'bootajax' + ']<\/p>';
datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn;
/// datasform='ps='+ps;
/// sctappli="/myproducts_sites/ow/scripts/";
//// urlphp = sctappli+file;
}
else
datasform=Form.serialize('form'+value);
// alert("ljs:61 "+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"datasform: "+datasform);
//===
tagfct = .kjsparams={'isform':isform,'urlphp':urlphp,'div':div,'divname':divname,'value':value,'demand':demand};
params=datasform;
// https://www.tutorialspoint.com/prototype/prototype_ajax_request.htm { success: 'xhr', failure: 'notice' },
// var toAjax = new Ajax.Updater(div, urlphp,
myDebug.line=82;
myDebug.debug_view_e_catch(myDebug.line,tagfct = );
///alert('lj:217 div='+div+myDebug.chrrc+'params='+JSON.stringify(params));
///alert("ljs:89 divname: "+div+myDebug.chrrc+"$Prot(div): "+$Prot(div)+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"value: "+value+myDebug.chrrc+"datasform: "+JSON.stringify(datasform));
alert("ljs:89 divname: "+div+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"value: "+value+myDebug.chrrc+"datasform: "+JSON.stringify(datasform));
/*
var myAjax=new Ajax.Updater(div,urlphp,{
postBody: $H({'datasform':datasform}).toQueryString(),
evalScripts: true,
https://www.tutorialspoint.com/prototype/prototype_ajax_updater.htm#:~:text=This%20AJAX%20Ajax.,is%20a%20specialization%20of%20Ajax.
https://stackoverflow.com/questions/15565203/what-is-the-equivalent-of-ajax-updater-in-jquery
https://mahtonu.wordpress.com/2010/05/06/updating-your-page-dynamically-with-ajax-updater-prototype-api/
https://openclassrooms.com/forum/sujet/ajax-prototype-ajax-updater-gt-jascript-non-evalue-14078
https://itecnote.com/tecnote/javascript-ajax-updater-problem/
https://cscie12.dce.harvard.edu/lecture_notes/2006-07/20070320/slide46.html
https://www.petefreitag.com/item/515.cfm
if($F('username').length == 5) {
var url = 'chkusername.php';
var params = 'username=' + $F('username');
var ajax = new Ajax.Updater(
{success: 'availability'},
url,
{method: 'get', parameters: params, onFailure: reportError});
}
*/
var renderParms = "userLogon=xxx&reportID=23";
var divstyledefault=js_get_image_of_loader();
document.getElementById("masterdiv").style.background=divstyledefault["bg"];
document.getElementById(divname).style.background=divstyledefault["bg"];
document.getElementById(divname).innerHTML=divstyledefault["img"];
$.post(urlphp,
{
///// datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn;
"demand": demand,
"value": value,
"ps": ps,
"sctappli": sctappli,
"jslang": jslang,
"refdat": refdat,
"dirr": dirr,
"filehere": filehere,
"conn": conn
}
/* JSON.stringify(datasform)*/,
function(data, status){
/////alert("Data: " + data + "\nStatus: " + status+ "\ndivname: " + divname);
document.getElementById(divname).style.color="black";
document.getElementById(divname).innerHTML="Data: " + data + "\nStatus: " + status;
});
/*
new Ajax.Updater(div, urlphp, {asynchronous:true,
method: 'post', evalScripts: true, parameters: renderParms,
onSuccess:function(request) {
$(div).style.color="black";
alert("in-out: \n"+xhr.responseText);
///Element.hide($('spinner'));
},
onException: function(request) {
///Element.hide($('spinner'));
}});
*/
/*
var myAjax = new Ajax.Updater(
/// {success: 'availability'},
div,
urlphp,
{
postBody: $H({///'urlhtml': urlhtml,
demand: demand,
value: value,
/// 'datasform':JSON.stringify(datasform)
/// 'datasform':JSON.stringify(tagfct = .kjsparams)
parameters:datasform
}).toQueryString(),
//// {method: 'post', parameters: JSON.stringify(datasform), onFailure: reportError ,
evalScripts: true,
/// onSuccess: successFunc,
/// onFailure: failureFunc,
onComplete : function(xhr){
var success=(xhr.status==200);
myDebug.line=95;
alert("ljs:70 success: "+success+myDebug.chrrc+"xhr.responseText: "+xhr.responseText
+myDebug.chrrc+"xhr.responseText.parse: "+JSON.parse(xhr.responseText)+myDebug.chrrc);
///alert("ljs:70 "+myDebug.chrrc+"sctappli: "+sctappli+myDebug.chrrc+"file: "+file+myDebug.chrrc+"isform: "+isform+myDebug.chrrc+"success: "+success+myDebug.chrrc+"xhr.responseText: "+xhr.responseText);
/// div= $Prot(divname);
var tag,skip=false,response=xhr.responseText,jsonResponse=JSON.parse(response);
/// alert(demand+' -\n '+divname+' -\n '+success+' -\n '+response);
/// if(!skip&&success&&demand=='fsend'){
/// ///alert(demand+' \n '+jsonResponse['return']); //c jsonResponse['return']='ok'
/// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok'
/// }
if(!skip&&success&&(demand=='ftest'||demand=='fsend')){
var total=0;
for(var j=0;j