JSFiddle - React, Tailwind, and code Playground

by Gwyn Milcote

JavaScript

$(function(){
	var item = 0; var qty = 1; var wanted = 0; var wantedqty = 1;
	
	$('.trade_create_btn').click(function(){
	$('.trade_create_result').html('aaaahaaa'); return;
	});
	
	
	$('.trade_cancel_btn').click(function(){
	$('.trade_cancel_result').html('aaaaaaa'); return;
	
	    var trade = $(this).data('trade');
	    $('.trade_cancel_result').html('Withdrawing offer '+trade+'...');
	    $.ajax({ type: 'POST', url: '../../ajax/ms_itemtrade.php', data: { whatdo: 'cancel', trade: trade, uid: 1 },
	    success: function(result){ 
	        if(result == 'Withdrawn.'){
	            $('.trade_cancel_result').html('Your offer has been withdrawn. The item was returned to your inventory.');
	            $('.trade_offer_'+trade).fadeOut(300);
	        }else{
	            $('.trade_cancel_result').html(result);
	        }
	    }
	});  return false; });
	
	$('select').change(function(){
	    item = $('.trade_give_item').val();
	    qty = $('.trade_give_qty').val();
	    wanted = $('.trade_wanted_item').val();
	    wantedqty = $('.trade_wanted_qty').val();
	
	    $('.give_img').html("<img src='../../pics/items/"+item+".png'>");
	    $('.wanted_img').html("<img src='../../pics/items/"+wanted+".png'>");
	    if(wanted == 0){
	        $('.trade_create_confirm').html('Are you sure? You want nothing back?<br>A random stranger will pick up your item as a free gift.<br>Very generous, but please be sure before confirming!');
	    }
	});
	
	$('.trade_create_btn').click(function(){
	$('.trade_create_result').html('aaaahaaa'); return;
	    if(item == 0){
	        $('.trade_create_result').html('Hey, you need to choose something to give!<br>No asking for free stuff here.'); return;
	    }
	    if(qty < 1 || wantedqty < 1){
	        $('.trade_create_result').html('That is not a valid quantity.'); return;
	    }
	    $('.trade_create_result').html('Creating offer...');
	    $.ajax({ type: 'POST', url: '../../ajax/ms_itemtrade.php', data: { whatdo: 'create', item: item, qty: qty, wanted:...