Click here to Skip to main content
15,887,283 members
Home / Discussions / Web Development
   

Web Development

 
Questionhelp with making inner table borders white Pin
Nico Haegens1-May-14 5:34
professionalNico Haegens1-May-14 5:34 
AnswerRe: help with making inner table borders white Pin
Richard Deeming1-May-14 6:00
mveRichard Deeming1-May-14 6:00 
GeneralRe: help with making inner table borders white Pin
Nico Haegens1-May-14 6:20
professionalNico Haegens1-May-14 6:20 
GeneralRe: help with making inner table borders white Pin
Richard Deeming1-May-14 6:27
mveRichard Deeming1-May-14 6:27 
GeneralRe: help with making inner table borders white Pin
Nico Haegens1-May-14 7:00
professionalNico Haegens1-May-14 7:00 
Questionhelp with CSS Pin
Jassim Rahma30-Apr-14 12:44
Jassim Rahma30-Apr-14 12:44 
AnswerRe: help with CSS Pin
vbmike3-May-14 12:13
vbmike3-May-14 12:13 
QuestionHow do I extract contents of php file and dump into a variable called aaData? Pin
samflex30-Apr-14 7:12
samflex30-Apr-14 7:12 
I am down to the last major task of my project and it is giving me griefs.

This block of code below allows me to load jquery datatable with data from a php file called getUsers.php filtered by userID.

PHP
$(document).ready(function() {
    /* Init DataTables */
$("#example").dataTable( {
	"sProcessing" : true,
"sDom":'T<"clear">',
"sJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>',
    "sAjaxSource" : "getUsers.php?loginName=<?php echo $user; ?>",
    "sAjaxDataProp" : "",
    "sDestroy" : false,
        "sScrollXInner": "110%",
    "fnServerData" : function(sSource, aoData, fnCallback) {
        request = $.ajax({
            "dataType" : "json",
            "type" : "GET",
            "url" : sSource,
            "data" : aoData,
            "success" : fnCallback
        });
    },
         "aoColumns" : [

         { "mDataProp": "RequestID", "sWidth": "50px", sSortable: true,
           "bSearchable": false,
           "bSortable": false,
           "fnRender": function (oObj)
            {
             // oObj.aData[0] returns the RequestID
                return "<a target='tab' data-tab-name='#RequestDetails' data-tab-index='2' href='phpservices/details.php?requestID="
                                + oObj.aData["RequestID"] + "'> " + oObj.aData["RequestID"] + " </a>";
                        }
                       },

        ],
      })


Further down the code above is this line which adds hyperlink to the fieldname called RequestID:

questID"] + " ";

PHP
return "<a target='tab' data-tab-name='#RequestDetails' data-tab-index='2' href='phpservices/details.php?requestID="
                               + oObj.aData["RequestID"] + "'> " + oObj.aData["RequestID"] + " </a>";


Finally, the code below allows us to display the details of user's selection in another tab:

PHP
$("#example").on("click", "a[target='tab']", function(){
  var me = $(this);
  var url = me.attr("href");
  var tabName = me.data("tabName");
  var tabIndex = parseInt(me.data("tabIndex"), 10);
  $.get(url, function(data) {
var table = $( '<table cellpadding="4" cellspacing="0" border="1"/>' ),
    tr = $( '<tr/>' ),
    td = $( '<td/>' ),
    th = $( '<th/>' );
tr.clone().html( th.text( 'ID' ) )
.append(th.clone().text( 'Date' ) )
.append(th.clone().text( 'Status' ) )
.append(th.clone().text( 'Assigned To' ) )
.appendTo(table );

     $.each(data.aaData, function(i,v) {
       tr.clone().html( td.clone().html(v[0]))
       .append(td.clone().html(v[1]))
       .append(td.clone().html(v[2]))
       .append(td.clone().html(v[3]))
       .appendTo(table);
    });
    $(tabName).html(table);
    // Activate the tab once the page has loaded:
    $("#tabs").tabs("option", "active", tabIndex);
    }, 'json');
     // Prevent the browser from following the link:
    return false;
 });


All of these work fine except one major problem.

When you click the requestID link, the hope is that the contents of details.php is displayed in requestdetails tab but it doesn't. It displays blank screen.

Does anyone know how to extract the contents of details.php file into a variable called aaData?

I will to be able to reference it and use it to load data into that other tab using:

$.each(data.aaData, function(i,v) {
...
...

Sorry if this is confusing, I can provide some clarity.

I am really desparate.

Thanks a lot in advance
QuestionOwin Pin
ernest_hemingway07730-Apr-14 2:56
professionalernest_hemingway07730-Apr-14 2:56 
Questionwhat & how to prepare for ASP.net and php interview in one month Pin
Akash Tripathi29-Apr-14 4:03
Akash Tripathi29-Apr-14 4:03 
SuggestionRe: what & how to prepare for ASP.net and php interview in one month Pin
Richard Deeming29-Apr-14 4:40
mveRichard Deeming29-Apr-14 4:40 
QuestionAbout PHP and ASP Discussion Pin
Abhinandan Nimsarkar29-Apr-14 0:35
Abhinandan Nimsarkar29-Apr-14 0:35 
AnswerRe: About PHP and ASP Discussion Pin
thatraja29-Apr-14 2:28
professionalthatraja29-Apr-14 2:28 
GeneralRe: About PHP and ASP Discussion Pin
Abhinandan Nimsarkar29-Apr-14 2:57
Abhinandan Nimsarkar29-Apr-14 2:57 
GeneralRe: About PHP and ASP Discussion Pin
thatraja29-Apr-14 3:33
professionalthatraja29-Apr-14 3:33 
QuestionMy data is not loading into another tab when clicked. Any ideas? Pin
samflex28-Apr-14 17:00
samflex28-Apr-14 17:00 
QuestionServer returned HTTP response code: 403 for URL: ....? Pin
Hy Chanhan28-Apr-14 16:40
professionalHy Chanhan28-Apr-14 16:40 
AnswerRe: Server returned HTTP response code: 403 for URL: ....? Pin
Kornfeld Eliyahu Peter28-Apr-14 21:55
professionalKornfeld Eliyahu Peter28-Apr-14 21:55 
QuestionHELP Coding search button in VB Pin
ynettep28-Apr-14 14:21
ynettep28-Apr-14 14:21 
AnswerRe: HELP Coding search button in VB Pin
Richard Andrew x6428-Apr-14 14:49
professionalRichard Andrew x6428-Apr-14 14:49 
GeneralRe: HELP Coding search button in VB Pin
ynettep28-Apr-14 15:06
ynettep28-Apr-14 15:06 
AnswerRe: HELP Coding search button in VB Pin
Wes Aday28-Apr-14 15:10
professionalWes Aday28-Apr-14 15:10 
GeneralRe: HELP Coding search button in VB Pin
ynettep28-Apr-14 15:35
ynettep28-Apr-14 15:35 
GeneralRe: HELP Coding search button in VB Pin
Wes Aday29-Apr-14 1:08
professionalWes Aday29-Apr-14 1:08 
AnswerRe: HELP Coding search button in VB Pin
ZurdoDev28-Apr-14 15:53
professionalZurdoDev28-Apr-14 15:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.