2011-09-19 4 views
1

구문을 잘못 이해하고 있는지 또는 개념을 이해하지 못했는지 알 수 없습니다. JavaScript 변수를 가져 와서 jQuery 함수 내부의 URL 매개 변수로 연결하려고합니다. 변수는 다른 업로드 스크립트의 jQuery 함수에 의해 재 할당됩니다. 당신의 따옴표의 위치업로드 스크립트 - jQuery 매개 변수 내부의 자바 스크립트 변수

<script type="text/javascript"> 
var trackid = 12; 


jQuery(document).ready(function() { 

    $('#mainftp2').uploadify({ 
    'uploader' : 'js/uploadifymultiple/uploadify.swf', 
    'script' : 'js/uploadifymultiple/uploadify.php?<?php echo urlencode("songid=" . $songid . "&userid=" . $userid . "&trackid=);?>'+trackid+'"', 
    'multi'   : true, 
    'auto'   : true, 
    'height'  : '32', //height of your browse button file 
    'width'   : '250', //width of your browse button file 
    'sizeLimit' : '51200000', //remove this to set no limit on upload size 
    'simUploadLimit' : '3', //remove this to set no limit on simultaneous uploads 
    'buttonImg' : 'img/browse.png', 
    'cancelImg' : 'img/cancel.png', 
     'folder' : '<?php echo $multiFolder?>', //folder to save uploads to 
     onProgress: function() { 
      $('#loader2').show(); 
     }, 
     onComplete: function(event, queueID, fileObj, response, data) { 
      $('#loader2').hide(); 
      $('#allfiles2').load(location.href+" #allfiles2>*",""); 
      $('#filesUploaded2').attr('value', ''+response+''); 

      //location.reload(); //uncomment this line if youw ant to refresh the whole page instead of just the #allfiles div 
     } 
    }); 

    $('ul li:odd').addClass('odd'); 

}); 
    </script> 

답변

0

확인, 당신은 PHP 조각 내부에 하나의 누락 및 URL의 끝에 추가 하나를 가지고 있습니다. 먼저 우리는 우리가 알고있는 부분에 초점을 맞출 것이다

script: 'js/uploadifymultiple/uploadify.php?<?php echo urlencode("songid=" . $songid . "&userid=" . $userid . "&trackid=);?>'+trackid+'"', 

이 잘못되었습니다 :

'uploadify.php?<?php echo urlencode("songid=" . $songid . "&userid=" . $userid . "&trackid=);?>'+trackid+'"', 

물음표는 .php 부분 후입니다. songiduserid이 좋습니다.

'uploadify.php?<?php echo urlencode("&trackid=);?>'+trackid+'"', 

오 쓰레기, 어디 urlencode에 대한 우리의 호출에 닫는 인용입니까?

'uploadify.php?<?php echo urlencode("&trackid=");?>'+trackid+'"', 

그래서 지금 우리는 일부 자바 스크립트, 부품 PHP를의 문자열을 가지고, 그것은 맞습니다.

'uploadify.php?etc&trackid=' + trackid + '"', 

그러나 URL에는 꼬리말이 없으므로 추가해야합니다.

'uploadify.php?etc&trackid=' + trackid, 
+0

나는 이것을 디버깅하는 데 어려움을 겪고있다. 무슨 뜻인지 알 수있을거야? – user547794

+0

완료. 원하는 것을 지우는 희망. –