$('#detail').live("click",function(e){
e.preventDefault();
var val=$(this).val();
var url="popupDetail.php?detailCode="+val;
var name="";
var windowWidth="850";
var windowHeight="850";
var myleft=(screen.width)?(screen.width-windowWidth)/2:100;
var mytop=(screen.height)?(screen.height-windowHeight)/2:100;
var properties = "width="+windowWidth+",height="+windowHeight;
properties +=",scrollbars=no, top="+mytop+",left="+myleft;
window.open(url,name,properties);
alert(url);
});
function PageQuery(q) {
if(q.length > 1)
this.q = q.substring(1, q.length);
else
this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() {
return this.keyValuePairs;
}
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() {
return this.keyValuePairs.length;
}
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
function pageload() {
var value = queryString("detailCode");
alert(value);
$.ajax({
// A string containing the URL to which the request is sent.
url: "webAction.php",
type:"POST",
// Data to be sent to the server.
data:({idAction:"viewDataSP",valTitle:value}),
// The type of data that you're expecting back from the server.
dataType: "json",
// success is called if the request succeeds.
success:function(data){
// Iterate over a jQuery object, executing a function for each matched element.
if(!data){
$.each(data,function(index,value){
// Insert content, specified by the parameter, to the end of each element
// in the set of matched elements.
$('#TBtraining').append('<tr><td colspan="2">Title : '+value.title+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Special Title : '+value.special_title+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Detail : '+value.detail+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Hours : '+value.hours+' hours</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Days : '+value.days+' days</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Date : '+value.date+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Time : '+value.time+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">Location : '+value.location+'</td></tr>');
$('#TBtraining').append('<tr><td colspan="2">course coordinator : '+value.person_in_charge+'</td></tr>');
});
}else{
alert("No Data");
}
}
});
}