jQuery突然出现:Uncaught TypeError:非法调用

时间:2014-11-07 08:17:40

标签: javascript jquery ajax

以下代码正在运行,然后由于某种原因第二天它一直在抛出:未捕获TypeError:非法调用

我似乎无法弄清楚它会在哪里破灭。

function createFile() {
        var selected_retailer_uuid = $("#search_store_select").select2("val");
        var selected_video_uuid = $("#active_media_videos").select2("val");
        var StartDate = $("#add_new_row_start_date").val();
        var EndDate = $("#add_new_row_end_date").val();
        var number_of_screens = $("#num_of_screens").select2("val");
        var priority_upload_selected = $('#add_new_row_priority_upload').select2("val");
        var get_start_times = getFirstPlayedBox();
        var get_end_times = getSecondPlayedBox();
        var selected_weekday_val = $("#weekdays_selected_input").select2("val");

        $.ajax({
            type: 'POST',
            url: './inc/uploadManagerScript.php?argument=createVideoFile',
            data: {
                store_uuid: selected_retailer_uuid,
                media_uuid: selected_video_uuid,
                start_date: StartDate,
                end_date: EndDate,
                number_of_screens: number_of_screens,
                video_priority_upload: priority_upload_selected,
                start_time: get_start_times,
                end_time: get_end_times,
                weekday: selected_weekday_val
            },
            dataType: 'json'
            })
            .done(function(data) {
                if(data){
                    $(".upload_manager_confirm_save .upload_manager_confirm_text").html("File copied to process folder");
                    $(".upload_manager_confirm_save").fadeIn(300).delay(1000).fadeOut(500);
                }
            });
    }

此代码获取get_start_times,它与get_start_times相同。

 var start_time = [];
    function getFirstPlayedBox(){
        var start_time = [];
        $.each($('[class^=created_firstBox]'), function (i, item){
            start_time.push($(this).val());
        });

        for(i=0;i<start_time.length;i++){
            start_time[i];
        }

        return start_time;
    }

html:

<div class="start_date_frmSplitLeft"><div class="err"></div><label for="start_date" class="add_new_row_text_color">Start Date: </label><input type="text" class="edit_add_new_row_upload_Box" id="add_new_row_start_date" name="add_new_row_start_date" required readonly /></div>
                    <div class="end_date_frmSplitRight"><div class="err"></div><label for="end_date" class="add_new_row_text_color">End Date: </label><input type="text" class="edit_add_new_row_upload_Box" id="add_new_row_end_date" name="add_new_row_end_date" required readonly /></div>
                </span>
            </fieldset>
            <div id="times_wrapper">
                <fieldset>
                    <span>
                        <div class="times_played_start"><label class="add_new_row_text_color">Times Played: </label></div>
                    </span>
                </fieldset>

                <fieldset>
                    <span>
                        <label id="lbl_add_new_row" ><i class="icon-plus" >Add New Row</i></label>
                    </span>
                </fieldset>
            </div>
            <fieldset>
                <span>
                    <!--<form method="get">-->
                        <div class="err"></div>
                        <label for="weekdays_selected_input" class="label_colour">Days Played: </label>
                        <select multiple id="weekdays_selected_input" name="weekdays_selected_input" required >
                            <option id="mon" value="mon">Monday</option>
                            <option id="tue" value="tue">Tuesday</option>
                            <option id="wed" value="wed">Wednesday</option>
                            <option id="thu" value="thu">Thursday</option>
                            <option id="fri" value="fri">Friday</option>
                            <option id="sat" value="sat">Saturday</option>
                            <option id="sun" value="sun">Sunday</option>
                        </select>
                    <!--</form>-->
                </span>
            </fieldset>

            <fieldset>
                <span>
                    <div class="err"></div>
                    <label for="add_new_row_priority_upload" class="label_colour">Priority Upload: </label>
                    <select id="add_new_row_priority_upload" name="add_new_row_priority_upload" class="leftStyle comboboxStyle" required >
                        <option></option>
                        <option>Yes</option>
                        <option>No</option>
                    </select>
                </span>
            </fieldset>

            <fieldset>
                <span>
                    <div class="err"></div>
                    <label class="label_colour">Videos: </label>
                    <select id="active_media_videos" name="active_media_videos" class="leftStyle comboboxStyle" required>
                    </select>
                </span>
            </fieldset>

            <fieldset>
                <span>
                    <div class="err"></div>
                    <label class="label_colour">Select Retailer: </label>
                    <select id="search_store_select" name="search_store_select" class="leftStyle comboboxStyle" required >
                    </select>
                </span>
            </fieldset>

            <fieldset>
                <select id="country_sel" placeholder="Select a country"></select>
            <select id="province_sel" placeholder="Select a province"></select>
            </fieldset>

            <fieldset>
                <label class="label_colour">Selection</label>
                <ul id="store_selection" title="Double click to add to schedule"></ul>
            </fieldset>

            <fieldset id="storeSelectedWrapper">
                <label class="label_colour">Selected</label>
                <ul id="store_selected" title="Double click to remove from schedule"></ul>
            </fieldset>

我正在与一个小团队合作。我不知道是谁改变了什么,但它已经坏了。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

$.ajax({
        type: 'POST',
        url: './inc/uploadManagerScript.php?argument=createVideoFile',
        data: {
            store_uuid: selected_retailer_uuid,
            media_uuid: selected_video_uuid,
            start_date: StartDate,
            end_date: EndDate,
            number_of_screens: number_of_screens,
            video_priority_upload: priority_upload_selected,
            start_time: get_start_times,
            end_time: get_end_times,
            weekday: selected_weekday_val
        },

应删除number_of_screens,因为没有来自它的输入。