Click here to Skip to main content
15,910,787 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Need help understanding this piece of code Pin
ZurdoDev15-Jul-16 5:26
professionalZurdoDev15-Jul-16 5:26 
GeneralRe: Need help understanding this piece of code Pin
Jaime Premy16-Jul-16 18:22
professionalJaime Premy16-Jul-16 18:22 
GeneralRe: Need help understanding this piece of code Pin
ZurdoDev17-Jul-16 8:19
professionalZurdoDev17-Jul-16 8:19 
QuestionWhat is the work of callback argument in NodeJs "module.exports"? Pin
MaxySpark4-Jul-16 10:03
MaxySpark4-Jul-16 10:03 
AnswerRe: What is the work of callback argument in NodeJs "module.exports"? Pin
rah_sin12-Jul-16 0:42
professionalrah_sin12-Jul-16 0:42 
QuestionForming your own panel Pin
Member 126139631-Jul-16 3:06
Member 126139631-Jul-16 3:06 
AnswerRe: Forming your own panel Pin
Richard MacCutchan1-Jul-16 3:48
mveRichard MacCutchan1-Jul-16 3:48 
QuestionError in parentNode.replaceChild while hiding content which is available in web page Pin
srikrishnathanthri1-Jul-16 2:41
srikrishnathanthri1-Jul-16 2:41 
QuestionChange webpage background on the fly (If it worked) Pin
Born5929-Jun-16 2:00
Born5929-Jun-16 2:00 
AnswerRe: Change webpage background on the fly (If it worked) Pin
Richard Deeming29-Jun-16 2:06
mveRichard Deeming29-Jun-16 2:06 
PraiseRe: Change webpage background on the fly (If it worked) Pin
Born5929-Jun-16 2:12
Born5929-Jun-16 2:12 
QuestionJSHint & Sublime use and config Pin
DavidMillar246828-Jun-16 21:00
DavidMillar246828-Jun-16 21:00 
AnswerRe: JSHint & Sublime use and config Pin
Richard MacCutchan28-Jun-16 21:20
mveRichard MacCutchan28-Jun-16 21:20 
AnswerRe: JSHint & Sublime use and config Pin
Kornfeld Eliyahu Peter28-Jun-16 22:55
professionalKornfeld Eliyahu Peter28-Jun-16 22:55 
QuestionConfirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx23-Jun-16 12:35
professionaljkirkerx23-Jun-16 12:35 
AnswerRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
Graham Breach23-Jun-16 23:17
Graham Breach23-Jun-16 23:17 
GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx24-Jun-16 6:10
professionaljkirkerx24-Jun-16 6:10 
It's not the actual code, just an example. I did some searching before my post and tested some other thoughts. Some thoughts talked about it being an async function and the code just ran through.

The code is pretty large in size, but I will post it. It's all on one page or external script file.

I did test it compressed and uncompressed thinking that my gulp script that compresses the script for production use was making an error of some sort.

The only thing that I can think of is a bug in Firefox, but I doubt that!
$(document).ready(function () {

     $("#sectionDelete").click(function () {
        $("#sectionForm").validate({
            ignore: "",
            errorClass: 'input-validation-error',
            rules: {
                Section_DeptID: {
                    required: true,
                    minLength: 1
                },
                Section_SectiontID: {
                    required: true,
                    minLength: 1
                },
                Section_Name: {
                    required: true,
                    minLength: 2
                },
                Section_Desc: {
                    required: true,
                    minLength: 2
                }
            },
            messages: {
                Section_Name: 'Section requires a name',
                Section_Desc: 'Section requires a description'
            },
            highlight: function (element, errorClass) {
                $(element).addClass(errorClass);
            },
            unhighlight: function (element, errorClass) {
                $(element).removeClass(errorClass);
            },
            success: function (result) {
                if (result === "1") {
                    return true;
                }
                else {
                    return false;
                }
            }
        });
        if ($("#sectionForm").valid()) {
            var deptID = parseInt($("#Section_DeptID").val()),
                sectionID = parseInt($("#Section_SectionID").val());
            if ((isNaN(deptID) || deptID === -1) && (isNaN(_sectionID) || sectionID === -1)) {
                $("#selectSection").text('You must select a section first!').addClass('text-danger');
            }
            else {
                sectionDelete();
            }
        }<br />
    });

});
This is the function that is called from above.
function sectionDelete() {

    var $e_Section_DeptID       = $("#Section_DeptID"),
        $e_Section_SectionID    = $("#Section_SectionID"),
        $e_Section_Name         = $("#Section_Name"),
        $e_sContainer           = $("#Section_Container"),
        _deptID                 = parseInt($e_Section_DeptID.val()),
        _sectionID              = parseInt($e_Section_SectionID.val()),
        _name                   = $e_Section_Name.val(),
        _confirm                = confirm('Are you sure you want to delete the section ' + _name);

     if (_confirm === true) {
        $e_sContainer.empty().append(pWait);
        $.ajax({
            type: "POST",
            cache: true,
            dataType: "json",
            url: '/Ajax/json_section_delete',
            data: { DeptID: _deptID, SectionID: _sectionID },
            error: function (response) {
                debugger;
                thisObj.toggleClass('active');
                alert("http code: " + response.status + " Error: json_sections_load - data: " + response);
            },
            success: function (data) {
                if (data.length === 0) {
                    $e_sContainer.empty().append(pNull);
                }
                else {
                    var sections = '<ul class="nav nav-pills nav-justified">';
                    for (var x = 0; x < data.length; x++) {
                        if (data[x].Enabled === true) {
                            sections += '<li class="col-xs-3" style="width: 33%; float: left; margin: 1% 0;"><button class="section btn btn-success btn-sm" title="' + data[x].Description + '" data-val="1" onclick="sectionRecordLoad(this, ' + data[x].SectionID + '); return false;" type="button">' + data[x].Name + '</button></li>';
                        }
                        else {
                            sections += '<li class="col-xs-3" style="width: 33%; float: left; margin: 1% 0;"><button class="section btn btn-warning btn-sm" title="' + data[x].Description + '" data-val="0" onclick="sectionRecordLoad(this, ' + data[x].SectionID + '); return false;" type="button">' + data[x].Name + '</button></li>';
                        }
                    }
                    sections += '</ul>';
                    $e_sContainer.empty().append(sections);
                }
            }
        });
     }     
}

GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
Graham Breach24-Jun-16 23:54
Graham Breach24-Jun-16 23:54 
GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx26-Jun-16 9:01
professionaljkirkerx26-Jun-16 9:01 
QuestionJQuery Validator, rules highlight creates label under textbox that is wrong class. Pin
jkirkerx22-Jun-16 9:34
professionaljkirkerx22-Jun-16 9:34 
AnswerRe: JQuery Validator, rules highlight creates label under textbox that is wrong class. [solved] Pin
jkirkerx22-Jun-16 12:34
professionaljkirkerx22-Jun-16 12:34 
GeneralMultidimensional Array in JavaScript Pin
HubSnippets22-Jun-16 2:05
HubSnippets22-Jun-16 2:05 
AnswerRe: Ajax succees event not firing with jsonp Pin
Peter_in_278021-Jun-16 17:23
professionalPeter_in_278021-Jun-16 17:23 
QuestionJquery Row details open Pin
Member 1130579120-Jun-16 3:31
Member 1130579120-Jun-16 3:31 
QuestionHow to compute XOR logic? Pin
AmalRaj@Sync19-Jun-16 19:05
AmalRaj@Sync19-Jun-16 19:05 

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.