Key up function works great, but for some reason the ajax doesn't work to update the other information. how or where do i add back in the "rightnow" trigger handler so the rest of the page updates.
Sorry i am new to this and is out of my current skillset.The below was my original code and from what i can make out it binded a function rightnow with a trigger at the end.
- $("#ajaxform").bind('rightnow change keyup', function(e) {
- $.ajax({
- type: "POST",
- url: "<?php echo ROOT; ?>ajax.php",
- data: $('#ajaxform').serialize(),
- success: function(html) {
- $("#ajaxresults").html(html).show();
- }
- });
- })
- .triggerHandler("rightnow");
- });
UPDATED - i tried the below code which seems to work, but for some reason the size box only appears when you click the 2nd colour it no longer loads on the page on first page load.
- $(function() {
- var magicalTimeout=500;
- var timeout;
- $("#ajaxform").on('keyup change rightnow', function(e) {
- var form=this
- clearTimeout(timeout);
- timeout=setTimeout(function(){
- $.ajax({
- type: "POST",
- url: "<?php echo ROOT; ?>ajax.php",
- data: $('#ajaxform').serialize(),
- success: function(html) {
- $("#ajaxresults").html(html).show();
- }
- });
-
- // console.log(form,$(form).serialize())
- },magicalTimeout)
- }).triggerHandler('keyup rightnow');
- });
everything seems to take 500ms instead of just the input fields. you can view the example here FYI click the first link first then the 2nd link