| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- $.ajax({
- type: "get",
- url: "./script/php/getTypeList.php",
- dataType: "json",
- async: false,
- success: function(data) {
- $.each(data.equipmentName, function(index, value) {
- $("#typeSelect").append("<option value='" + data.equipmentCode[index] + "'>" + value + "</option>");
- });
- },
- error: function(data) {
- console.log('error getDataTable:' + data);
- }
- });
- var $w1finish = $('#w1').find('ul.pager li.finish');
- $w1finish.on('click', function (ev) {
- ev.preventDefault();
- //alert("送出資料!");
- });
- $('#w1').bootstrapWizard({
- tabClass: 'wizard-steps',
- nextSelector: 'ul.pager li.next',
- previousSelector: 'ul.pager li.previous',
- firstSelector: null,
- lastSelector: null,
- onNext: function (tab, navigation, index, newindex) {
- },
- onTabClick: function (tab, navigation, index, newindex) {
- if (newindex == index + 1) {
- return this.onNext(tab, navigation, index, newindex);
- } else if (newindex > index + 1) {
- return false;
- } else {
- return true;
- }
- },
- onTabChange: function (tab, navigation, index, newindex) {
- var totalTabs = navigation.find('li').size() - 1;
- $w1finish[newindex != totalTabs ? 'addClass' : 'removeClass']('hidden');
- $('#w1').find(this.nextSelector)[newindex == totalTabs ? 'addClass' : 'removeClass']('hidden');
- }
- });
- $("#typeSelect").change(function() {
- type = $(this).val();
- $.ajax({
- type: "get",
- url: "./script/php/getTypeDetail.php",
- dataType: "json",
- data: {
- type: type
- },
- async: false,
- success: function(data) {
- var table = JSON.parse(data.table);
- $("#w1-profile").empty();
- $.each(data.columnName, function(index, value) {
- if (index % 4 == 0) {
- $("#w1-profile").append('<div class="form-group" id="w1-profile-group' + index + '">');
- $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index]] +
- '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
- if (index + 1 < data.columnName.length)
- $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 1]] +
- '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
- if (index + 2 < data.columnName.length)
- $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 2]] +
- '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
- if (index + 3 < data.columnName.length)
- $("#w1-profile-group" + index).append('<label class="col-md-1 control-label" for="inputDefault">' + table[0][data.columnName[index + 3]] +
- '</label><div class="col-md-2"><input type="text" class="form-control" id="input' + index + '"></div>');
- $("#w1-profile").append('</div>');
- }
- });
- },
- error: function(data) {
- console.log('error getDataTable:' + data);
- }
- });
- });
|