I've made a jquery/ajax function that updates #courses, sending #fos's .val() and .text(), specifically of the one that is selected, like so:
$('#selling #fos').change(function() {
$.post('/ajax/courses',
{
fos_id: $('#selling #fos').val(),
name: $('#selling #fos :selected').text()
},
function(data) {
$('#selling #courses').html(data);
});
});
How do I extend this function so that it uses 'this', allowing me to reuse this function multiple times on the same page? I'm caught because you can't use name: $(this + ' :selected').text()
.