diff --git a/parts/static/script.js b/parts/static/script.js index 4d45bb4..5268c98 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -1,3 +1,5 @@ +var rootURL = '/parts/' + function overlay_in() { $('.shadow').css({'display' : 'block'}); $('.overlay').css({'display' : 'block'}); @@ -123,7 +125,7 @@ function save(partID) { $.ajax({ // Your server script to process the upload - url: 'http://127.0.0.1:5000/parts/alter/' + partID, + url: rootURL + 'alter/' + partID, type: 'POST', data: data, @@ -162,7 +164,7 @@ function delete_entry(partID) { if (!confirm('Delete the selected entry?')) return; $.ajax({ - url: 'http://127.0.0.1:5000/parts/delete/' + partID, + url: rootURL + 'delete/' + partID, type: 'GET', cache: false, contentType: false, @@ -178,7 +180,7 @@ function delete_entry(partID) { } function show_part_info(partID) { - $.getJSON('http://127.0.0.1:5000/parts/getpartinfo/' + partID, function(data) { + $.getJSON(rootURL + 'getpartinfo/' + partID, function(data) { $('table#details tr#location td p').text(text_filter(data.name)); // name is the location friendly name $('table#details tr#location td select').val(data.location_id); // name is the location friendly name $('table#details tr#partno td p').text(text_filter(data.partno)); @@ -187,7 +189,7 @@ function show_part_info(partID) { $('table#details tr#description td input').val(text_filter(data.description)); $('img#map').attr('src', 'parts/map/' + data.map); if (data.datasheet != null) - $('tr#datasheet-head').html($('DATASHEET: ')); + $('tr#datasheet-head').html($('DATASHEET: ')); else $('tr#datasheet-head td').text('DATASHEET: '); $('#edit-button').click(function() { @@ -212,7 +214,7 @@ function perform_query() { n:$('#notes').is(':checked') }; filter = '0'; - $.getJSON('http://127.0.0.1:5000/parts/query/' + filter + '/' + query, data, function(data) { + $.getJSON(rootURL + 'query/' + filter + '/' + query, data, function(data) { $("#results").find("tr:not(:first)").remove(); // Delete all table rows for(var i = 0; i < data.length; i++) { var newRow = $('');