New & Used Chevrolet Corvette Cars for Sale

Save Search
Voice Search
Search By Photo
Save Search
Sort
Sort
Type View
Clear

clear

clear


Min Year Max Year
clear

$3,000 - $100,000+
clear

clear

clear

0 km - 100,000+ km

clear

clear
clear

clear

clear

clear
clear

clear

clear
Clear

Out of 0 Results

      // on mob colors change $('#mob-colors input[type="checkbox"]').on('change', function() { handleMobileFormChange(); // Adjust delay as needed (e.g., 300ms) }); $('#desksetMyLocation').on('click', function() { // console.log('Button #desksetMyLocation clicked'); clearTimeout(debounceTimer); debounceTimer = setTimeout(handleFormChange, 300); // Adjust delay as needed (e.g., 300ms) }); $('#car-PostCode').off('change.locationfix').on('change.locationfix', function() { if (validatepostcity()) { clearTimeout(debounceTimer); $('#radius-error').text(''); debounceTimer = setTimeout(handleFormChange, 300); } }); $('#car-PostCode').off('input.locationfix').on('input.locationfix', function() { clearTimeout(errorTimeout); $('#radius-error').text(''); }); $('#mob-PostCode').off('input.locationfix').on('input.locationfix', function() { clearTimeout(errorTimeout); $('#radius-error-mob').text(''); }); function validatepostcityMob() { var input = $('#mob-PostCode').val().trim(); if (!input || input.toLowerCase() === 'locating...') { $('#radius-error-mob').text(''); return true; } var isPostalCode = input.length >= 2 && /\d/.test(input); if (isPostalCode) { var postalCodeRegex = /^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/; if (!postalCodeRegex.test(input)) { $('#radius-error-mob').text('Invalid postal code.'); return false; } $('#radius-error-mob').text(''); return true; } const inputLower = input.toLowerCase(); const sortedLocatio = filterAndSortLocations(inputLower); const isValidCity = sortedLocatio.some(item => { const cityOnly = (item.name || '').toLowerCase(); const cityWithProvince = item.adminName1 ? `${cityOnly}, ${item.adminName1.toLowerCase()}` : cityOnly; return inputLower === cityOnly || inputLower === cityWithProvince; }); if (!isValidCity) { $('#radius-error-mob').text('Invalid city.'); return false; } $('#radius-error-mob').text(''); return true; } $('#mob-PostCode').on("change", function() { $("#mob-clear-filter").show(); if (validatepostcityMob()) { clearTimeout(debounceTimer); debounceTimer = setTimeout(handleMobileFormChange, 300); // Adjust delay as needed (e.g., 300ms) } }); $('#desk-min-year').on('change', function() { var minYear = $(this).val(); var maxYear = $('#desk-max-year').val(); // disable all max years less than min year $('#desk-max-year option').each(function() { var option = $(this); var year = option.val(); if (year < minYear) { option.prop('disabled', true); } else { option.prop('disabled', false); } }); }); $('#desk-max-year').on('change', function() { var maxYear = $(this).val(); var minYear = $('#desk-min-year').val(); // disable all min years greater than max year $('#desk-min-year option').each(function() { var option = $(this); var year = option.val(); if (year > maxYear) { option.prop('disabled', true); } else { option.prop('disabled', false); } }); }); $('#mob-min-year').on('change', function() { var minYear = $(this).val(); var maxYear = $('#mob-max-year').val(); // disable all max years less than min year $('#mob-max-year option').each(function() { var option = $(this); var year = option.val(); if (year < minYear) { option.prop('disabled', true); } else { option.prop('disabled', false); } }); }); $('#mob-max-year').on('change', function() { var maxYear = $(this).val(); var minYear = $('#mob-min-year').val(); // disable all min years greater than max year $('#mob-min-year option').each(function() { var option = $(this); var year = option.val(); if (year > maxYear) { option.prop('disabled', true); } else { option.prop('disabled', false); } }); }); $('#items-count').on('change', function() { var url = data.first_page_url; currentPage = 1; // append pagination query string url = url + '&itemsPerPage=' + this.value; $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; displayResults(response.results.data); $('#currentPage').text((currentPage)); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) }); function createCustomPagination() { createBottomPagination(); createTopPagination(); } function createBottomPagination(){ var pagiantionList = $('#pagination-container-bottom').find('.paginationjs-pages ul'); var pagination = data.links; // slice the pagination array to remove the first and last elements pagination = pagination.slice(0, pagination.length - 1); var currentPage = data.current_page; pagiantionList.empty(); // append prev button var prev = $("
    • "); var aPrev = $(""); var iconPrev = $("").addClass("fas fa-chevron-left"); aPrev.append(iconPrev); aPrev.attr("data-page", currentPage - 1); aPrev.attr("data-url", data.prev_page_url); prev.addClass("paginationjs-prev J-paginationjs-prev"); prev.append(aPrev); pagiantionList.append(prev); // attach on click event on prev button aPrev.on("click", function () { if (currentPage > 1) { currentPage = currentPage - 1; var url = data.prev_page_url; if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) } }); for (var i = 1; i < pagination.length; i++) { var li = $("
    • "); var a = $(""); a.text(pagination[i].label); a.attr("data-page", i); a.attr("data-url", pagination[i].url); if (pagination[i].active === true) { li.addClass("active"); } li.addClass("paginationjs-page J-paginationjs-page"); li.append(a); pagiantionList.append(li); a.on("click", function () { var page = $(this).text(); currentPage = page; var url = $(this).data('url'); if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; // console.log('Data: ', data); totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); // move window to top first window.scrollTo(0, 0); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) }); } // append next button var next = $("
    • "); var aNext = $(""); var iconPrev = $("").addClass("fas fa-chevron-right"); aNext.append(iconPrev); aNext.attr("data-page", currentPage + 1); aNext.attr("data-url", data.next_page_url); next.addClass("paginationjs next J-paginationjs-next"); next.append(aNext); pagiantionList.append(next); // attach on click event on next button aNext.on("click", function () { if (currentPage < Math.ceil(totalItems / itemsPerPage)) { currentPage = currentPage + 1; var url = data.next_page_url; if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) } }); } function createTopPagination(){ var pagiantionList = $('#pagination-container-top').find('.paginationjs-pages ul'); var pagination = data.links; // slice the pagination array to remove the first and last elements pagination = pagination.slice(0, pagination.length - 1); var currentPage = data.current_page; pagiantionList.empty(); // append prev button var prev = $("
    • "); var aPrev = $(""); var iconPrev = $("").addClass("fas fa-chevron-left"); aPrev.append(iconPrev); aPrev.attr("data-page", currentPage - 1); aPrev.attr("data-url", data.prev_page_url); prev.addClass("paginationjs-prev J-paginationjs-prev"); prev.append(aPrev); pagiantionList.append(prev); // attach on click event on prev button aPrev.on("click", function () { if (currentPage > 1) { currentPage = currentPage - 1; var url = data.prev_page_url; if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) } }); for (var i = 1; i < pagination.length; i++) { var li = $("
    • "); var a = $(""); a.text(pagination[i].label); a.attr("data-page", i); a.attr("data-url", pagination[i].url); if (pagination[i].active === true) { li.addClass("active"); } li.addClass("paginationjs-page J-paginationjs-page"); li.append(a); pagiantionList.append(li); a.on("click", function () { var page = $(this).text(); currentPage = page; var url = $(this).data('url'); if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) }); } // append next button var next = $("
    • "); var aNext = $(""); var iconPrev = $("").addClass("fas fa-chevron-right"); aNext.append(iconPrev); aNext.attr("data-page", currentPage + 1); aNext.attr("data-url", data.next_page_url); next.addClass("paginationjs next J-paginationjs-next"); next.append(aNext); pagiantionList.append(next); // attach on click event on next button aNext.on("click", function () { if (currentPage < Math.ceil(totalItems / itemsPerPage)) { currentPage = currentPage + 1; var url = data.next_page_url; if (url === null) { return; } $.ajax( url, { method: 'GET', data: { }, success: function (response, status, xhr) { // console.log(response); results = response.results.data; data = response.results; totalItems = response.results.total; itemsPerPage = response.results.per_page; // console.log('Total Items: ', totalItems); // console.log('Items per page: ', itemsPerPage); displayResults(response.results.data); // $('#currentPage').text((currentPage)); currentPage = response.results.current_page; // createCustomPagination(); }, error: function (jqXhr, textStatus, errorMessage) { console.log('Error: ', errorMessage); } } ) } }); } createCustomPagination(); // on save search click fetch form values $('.save-search-btn').click(async () => { if (userId === null) { // User is not logged in, show a Swal message $('.loader').hide(); Swal.fire({ title: 'Login Required', icon: 'info', confirmButtonText: 'Login', html: 'You need to login to Save Search', }) return; // Stop further execution if the user is not logged in } var formValues = collectFormValues(); console.log(formValues); // generate a name for the search var searchName = generateSearchName(formValues); console.log(searchName); // generate a url for the search var url = await generateSearchUrl(formValues); console.log(url); if (url === '') { $('.loader').hide(); Swal.fire({ title: 'Error!', text: 'Error occured while saving your search!', icon: 'error', timer: 2000 }); return; } $.ajax({ url: "https://www.autobunny.com/saved-searches", type: 'post', data: { searchname: searchName, search_url: url }, headers: { 'X-CSRF-TOKEN': 'BaTH0LmPp3P80u018fWVtNO6Wr1apb722ZxilH5R' }, dataType: 'json', success: function(response) { if (response.isCreate) { $('.loader').hide(); Swal.fire({ title: 'Success!', text: 'Search ' + 'added to' + ' favorites!', icon: 'success', timer: 2000 }) updateSearchCount(); } else { $('.loader').hide(); Swal.fire({ title: 'Warning!', text: response.message, icon: 'warning', confirmButtonText: `
      `, }) } }, error: function(xhr, status, error) { $('.loader').hide(); console.error('Error saving search:', error); Swal.fire({ title: 'Error!', text: 'Error occured while saving your search!', icon: 'error', timer: 2000 }); } }); }) const generateSearchUrl = async (formValues) => { try { const response = await $.ajax({ url: "https://www.autobunny.com/Cars/inventoryListings/filters/url", method: 'GET', data: formValues, }); return response.url; // Assuming response contains the URL } catch (error) { console.error('Error generating search URL:', error); throw error; // Propagate the error for handling in the caller } }; const generateSearchName = (formValues) => { var searchName = ''; searchName += formValues.minYearValue !== '' ? formValues.minYearValue + ' ' : ''; searchName += formValues.maxYearValue !== '' ? formValues.maxYearValue + ' ' : ''; if (formValues.make.length > 0) { searchName += formValues.make.join(', ') + ' '; } if (formValues.model.length > 0) { searchName += formValues.model.join(', ') + ' '; } if (formValues.condition.length > 0) { searchName += formValues.condition.join(', ') + ' '; } if (formValues.transmission.length > 0) { searchName += formValues.transmission.join(', ') + ' '; } if (formValues.min_price !== '' && formValues.max_price !== '') { searchName += '$' + formValues.min_price + ' - $' + formValues.max_price + ' '; } if (formValues.bodyShape.length > 0) { searchName += formValues.bodyShape.join(', ') + ' '; } if (formValues.MaxMileage !== '') { searchName += formValues.MaxMileage + 'km '; } return searchName.trim(); } // $('.save-search-btn').on('click', function(event) { // event.preventDefault(); // $('.loader').show(); // var searchname = $('#search-title').html(); // var search_url = window.location.href; // if (userId === null) { // // User is not logged in, show a Swal message // $('.loader').hide(); // Swal.fire({ // title: 'Login Required', // icon: 'info', // confirmButtonText: 'Login', // html: 'You need to login to Save Search', // }) // return; // Stop further execution if the user is not logged in // } // $.ajax({ // url: "https://www.autobunny.com/saved-searches", // type: 'post', // data: { // searchname: searchname, // search_url: search_url // }, // headers: { // 'X-CSRF-TOKEN': 'BaTH0LmPp3P80u018fWVtNO6Wr1apb722ZxilH5R' // }, // dataType: 'json', // success: function(response) { // if (response.isCreate) { // $('.loader').hide(); // Swal.fire({ // title: 'Success!', // text: 'Search ' + 'added to' + ' favorites!', // icon: 'success', // timer: 2000 // }) // updateSearchCount(); // } else { // $('.loader').hide(); // Swal.fire({ // title: 'Warning!', // text: response.message, // icon: 'warning', // confirmButtonText: ` //
      // // // // //
      // `, // }) // } // }, // error: function(xhr, status, error) { // $('.loader').hide(); // console.error('Error saving search:', error); // Swal.fire({ // title: 'Error!', // text: 'Error occured while saving your search!', // icon: 'error', // timer: 2000 // }); // } // }); // }); // on save search click fetch form values $('.mob-save-search-btn').click(async () => { if (userId === null) { // User is not logged in, show a Swal message $('.loader').hide(); Swal.fire({ title: 'Login Required', icon: 'info', confirmButtonText: 'Login', html: 'You need to login to Save Search', }) return; // Stop further execution if the user is not logged in } var formValues = MobileFormValues(); console.log(formValues); // generate a name for the search var searchName = generateSearchNamemob(formValues); console.log(searchName); // generate a url for the search var url = await generateSearchUrlmob(formValues); console.log(url); if (url === '') { $('.loader').hide(); Swal.fire({ title: 'Error!', text: 'Error occured while saving your search!', icon: 'error', timer: 2000 }); return; } $.ajax({ url: "https://www.autobunny.com/saved-searches", type: 'post', data: { searchname: searchName, search_url: url }, headers: { 'X-CSRF-TOKEN': 'BaTH0LmPp3P80u018fWVtNO6Wr1apb722ZxilH5R' }, dataType: 'json', success: function(response) { if (response.isCreate) { $('.loader').hide(); Swal.fire({ title: 'Success!', text: 'Search ' + 'added to' + ' favorites!', icon: 'success', timer: 2000 }) updateSearchCount(); } else { $('.loader').hide(); Swal.fire({ title: 'Warning!', text: response.message, icon: 'warning', confirmButtonText: `
      `, }) } }, error: function(xhr, status, error) { $('.loader').hide(); console.error('Error saving search:', error); Swal.fire({ title: 'Error!', text: 'Error occured while saving your search!', icon: 'error', timer: 2000 }); } }); }) const generateSearchUrlmob = async (formValues) => { try { const response = await $.ajax({ url: "https://www.autobunny.com/Cars/inventoryListings/filters/url", method: 'GET', data: formValues, }); return response.url; // Assuming response contains the URL } catch (error) { console.error('Error generating search URL:', error); throw error; // Propagate the error for handling in the caller } }; const generateSearchNamemob = (formValues) => { var searchName = ''; searchName += formValues.minYearValue !== '' ? formValues.minYearValue + ' ' : ''; searchName += formValues.maxYearValue !== '' ? formValues.maxYearValue + ' ' : ''; if (formValues.make.length > 0) { searchName += formValues.make.join(', ') + ' '; } if (formValues.model.length > 0) { searchName += formValues.model.join(', ') + ' '; } if (formValues.condition.length > 0) { searchName += formValues.condition.join(', ') + ' '; } if (formValues.transmission.length > 0) { searchName += formValues.transmission.join(', ') + ' '; } if (formValues.min_price !== '' && formValues.max_price !== '') { searchName += '$' + formValues.min_price + ' - $' + formValues.max_price + ' '; } if (formValues.bodyShape.length > 0) { searchName += formValues.bodyShape.join(', ') + ' '; } if (formValues.MaxMileage !== '') { searchName += formValues.MaxMileage + 'km '; } return searchName.trim(); } });