JavaScript Why do I get back 2 responses of 200 and 204 when using an AJAX call to delete objects?

I've created some sample code below. You can delete items simply by clicking the text you want to delete (or the li element).

When you look at the network tab when you delete, you get back both a 204 and 200 response. Why are there two? I'm only making 1 call.

Where the heck is the request method "OPTIONS" coming from?

//Cache DOM
var $content 	= $( 'ul' );
var $name		= $( '#name' );
var $bike		= $( '#bike' );
var $addButton	= $( '#add-item' );
var $liElems 	= $( 'li' );

//Functions


$( function () {

	function addItem( data ) {
		$content.append( '<li id="' + data.id + '">' + data.name + ' likes ' + data.bike + '</li>' );
	}

	$.ajax( {
		type: 'GET',
		url: 'http://rest.learncode.academy/api/sjm/bikes',
		success: function( response ) {
			$.each( response, function( index, bikes ) {
				addItem( bikes );
			});
		},
		error: function( ) {
			console.log ( 'error loading orders' );
		}
	});

	$addButton.on( 'click', function(){
		var data = {
			name: $name.val(),
			bike: $bike.val()
		};

		$.ajax( {
			type: 'POST',
			url: 'http://rest.learncode.academy/api/sjm/bikes',
			data: data,
			success: function( response ) {
				addItem( response );
			},
			error: function( ) {
				console.log( 'error while saving' );
			}
		});
	});

	$content.delegate( 'li', 'click', function ( ) {
		var id = $( this ).attr( 'id' );
		var $this = $( this );

		console.log ( 'delete ' + id);
		$.ajax({
			type: 'DELETE',
			url: 'http://rest.learncode.academy/api/sjm/bikes/' + id,
			success: function( response ){
				$this.fadeOut( 300, function ( ) {
					remove( );
				});
			},
			error: function( ){
				console.log( 'error deleting data' );
			}
		});
	});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="content">
	<section>
		name <input type="text" id="name">
		bike <input type="text" id="bike">
		<button id="add-item">add data</button>
	</section>
	<ul></ul>
</div>
Answer:1

My authenticate.php file is returning an object Json: [{"u_id":"1","u_name":"Nabeel" }] Here is my js: success: function(result) { var obj=$.parseJSON(result); alert(result); //[{"u_id":"1"...

My authenticate.php file is returning an object Json: [{"u_id":"1","u_name":"Nabeel" }] Here is my js: success: function(result) { var obj=$.parseJSON(result); alert(result); //[{"u_id":"1"...

I'm writing a program that calculates the price of painting rooms in a house. The program asks the user a couple of questions and the user must input certain answers regarding the topic. The program ...

I'm writing a program that calculates the price of painting rooms in a house. The program asks the user a couple of questions and the user must input certain answers regarding the topic. The program ...

  1. javascript repeat validation

as stated in the name, i have a menu with links, and i have a list of sections which i want to show/hide on the click of the menu. What i want here is to be dynamic in a sense that if i add more menus ...

as stated in the name, i have a menu with links, and i have a list of sections which i want to show/hide on the click of the menu. What i want here is to be dynamic in a sense that if i add more menus ...

  1. show content only on mobile
  2. show content only on homepage wordpress
  3. show content only from this computer
  4. wordpress show content only to logged in users
  5. tar show content only
  6. curl show content only
  7. wordpress show content only if logged in
  8. php show content only if logged in
  9. chrome show content only
  10. show my cloud-only content from onedrive
  11. show hide content css only
  12. sharepoint show page content only
  13. how to show only content in excel
  14. ie show secure content only
  15. show content only

I'm using the 500px API module with Node.js and I'm trying to get photos of a specific user. I'm facing issue with function, callback and scope... I've this code : api500px.photos.getByUsername ('...

I'm using the 500px API module with Node.js and I'm trying to get photos of a specific user. I'm facing issue with function, callback and scope... I've this code : api500px.photos.getByUsername ('...

  1. return data callback function
  2. return data callback
  3. return data callback javascript
  4. return data from callback node js
  5. return data from callback function javascript
  6. return data from callback js
  7. return data ajax callback
  8. nodejs return data callback
  9. node return data from callback
  10. python return data from callback
  11. matlab return data from callback