If either is answered I will end the other.
As a jQuery/Ajax/tablesorter novice, I was hoping someone could explain what this code is actually doing (rather than me continuing to go on my assumptions). It seems to me, if I am seeing this correctly, that the developer began with too much happening.
I see the following happening:
1 - The campaign_array is getting loaded
2 - The $.ajax call on line 10 is happening
3 - The call to get _campaign_summary works, and the desired information is returned
4 - I can see the info required for the table in data through the console log - line 16
5 - Lines 17-19 seem to be calling get_campaign_summary again. This time the campaign_array parameter is empty so, as it should, my page does not show the table. (I can see this in a log file I write to in get_campaign_summary)
So, if what he wants is for the table to reload with the data retrieved by get_campaign_summary, what needs to come out (an assumption because of the two calls to get_campaign_summary) and what needs to change?
- $("form").on("submit", function(e){
- e.preventDefault();
- campaign_array = multi_list.campaign_list.multiselect("getChecked").map(function(){
- return this.value;
- }).get();
-
- console.log('Campaign Array: ', campaign_array);
-
- var ajaxObj = $.ajax({
- url : VALIDATION_URL + '?operation=get_campaign_summary&campaign_array=' + campaign_array,
- type : $(this).attr('method'),
- dataType: 'json',
- data : $(this).serialize(),
- success : function( data,html ) {
- console.log('Submitted: ', data);
- campaign_summary.table
- .html(html)
- .trigger("updateAll",[resort]);
- },
- error : function( data, xhr, err ) {
- console.log('Oops: ', data, xhr , err);
- }
- });
- console.log('ajaxObj: ', ajaxObj);
- return false;
- });