简体   繁体   中英

Firefox vs Safari with JavaScript

In Firefox, this code works like a charm...but in Safari, it doesn't execute...where am I going wrong?

$('#ul_stages li.stage').on('click', updateStageByClick);

function updateStageByClick() {
   var id = $(this).parent().attr('class').substr(6);
   var pid = $('form#data input[name=pid]').val();
   var stage = $(this).val();
   $.ajax({
     type: "POST",
     url: "/invite/stage",
     data: {project: pid, user: id, stage: stage},
     dataType: 'json',
     success: update
   });
   return false;
}

<ul id="ul_stages" class="stage_<?= $profile['user_id'] ?>">
   <li>SELECT STAGE:</li>
   <li class="stage_unviewed stage" value="0">Unviewed</li>
   <li class="stage_viewed stage" value="1">Viewed</li>
</ul>

尝试使用此:

$('form#data input[name="pid"]').val();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM