basic jquery question about syntax

Discussion in 'jQuery' started by ernest1a, Jun 9, 2009.

  1. #1
    I have one basic question about syntax. This is a function:

    
    function() {
                upload1 = new SWFUpload({
                    upload_url: "upload.php",
                    //continue...
    
    PHP:
    I want to give for each time function is called, a different name to upload1 and upload.php, like the following, but it is incorrect syntax:
    
    var number=1
    function(number) {
                upload+number = new SWFUpload({
                    upload_url: "upload+number+.php",
                    //continue...
    
    PHP:
    So how would be correct to assing 1 to the name of upload* variable and to upload*.php?

    tnx
     
    ernest1a, Jun 9, 2009 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,

    you can declare variable url as the same way as you did it for number:

    
    var number=1;
    var url='upload'+number+'.php';
    ..........................................
    function() {
                upload1 = new SWFUpload({
                    upload_url: url,
    ..........................................
    
    Code (markup):
    and inside the loop ( each() in jquery ) you have to increment number++
    I can recommend you this excellent jquery manual

    Regards
     
    koko5, Jun 9, 2009 IP