Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: JQuery Error

  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    26
    Thanks
    2
    Thanked 0 Times in 0 Posts

    JQuery Error

    Brief History:
    I'm working on a project that uploads some files to my server (all local still, so nothing live). I'm using JQuery for a lightbox feature, so I thought I'd try using the JQuery file upload addon posted here:
    http://www.phpletter.com/Our-Projects/AjaxFileUpload/

    Everything is working great, though I notice certain types of files (for example wmv) are causing the upload plugin to fail and popup an error, and I'm not sure why. I've tracked it down to this snippet of code however:
    Code:
    try 
    {
         status = isTimeout != "timeout" ? "success" : "error";
         // Make sure that the request was successful or notmodified
         if ( status != "error" )
         {
              // process the data (runs the xml through httpData regardless of callback)
              var data = jQuery.uploadHttpData( xml, s.dataType );    
              // If a local callback was specified, fire it and pass it the data
              if ( s.success )
                   s.success( data, status );
        
                   // Fire the global callback
                   if( s.global )
                        jQuery.event.trigger( "ajaxSuccess", [xml, s] );
         }
         else
              jQuery.handleError(s, xml, status);
    } 
    catch(e) 
    {
         status = "error";
         jQuery.handleError(s, xml, status, e);
    }
    More specifically, I believe I can't imagine this is anything else but the call:
    Code:
    jQuery.uploadHttpData( xml, s.dataType );
    The exact error I'm getting is:
    "SyntaxError: Unexpected token <"

    Any thoughts on what could cause that? Do I maybe have a version mis-match between my jquery, and the jquery that this upload tool expects? That's my only real guess.

    Thanks

    Edit: I'm using JQuery 1.2.3 according to the header in my jquery.js file.
    Last edited by sionice; 06-05-2009 at 10:07 AM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    The exact error I'm getting is:
    "SyntaxError: Unexpected token <"
    Could you post a link to your page?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    26
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Could you post a link to your page?
    No, unfortunately this is strictly on my local server and nothing is live yet since it doesn't work. I'm probably going to try updating to JQuery 1.3.1 later today to see if that changes anything though.

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Have you tried to set a break point and walk through the code and see where it dies?

    Are you 100% your XML is valid?

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • Users who have thanked A1ien51 for this post:

    sionice (06-05-2009)

  • #5
    New Coder
    Join Date
    May 2009
    Posts
    26
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by A1ien51 View Post
    Have you tried to set a break point and walk through the code and see where it dies?

    Are you 100% your XML is valid?

    Eric
    Well, I'm fairly certain because it works on almost all other files/types. However, I did just successfully upload another .wmv file to my server, so it's something specific having to do with this one file in particular that's failing.

    As a note, I updated to 1.3.1 and still had the same issue.

    I'm still pretty new to debugging javascript code, though I do have Web Developer running on Firefox, and it wasn't throwing any javascript errors. I'm totally open to a better recommendation on methods of debugging if you have them. =)

  • #6
    New Coder
    Join Date
    May 2009
    Posts
    26
    Thanks
    2
    Thanked 0 Times in 0 Posts
    For those who might be running into the same issue, my problem was hella retarded.

    It had nothing to do with the file itself, but rather poor error reporting on the end of the upload plugin. It was working on some files because, while I had changed "upload_max_filesize" in my php.ini file, I neglected to change "post_max_size" like the noob that I am.

    That's what I get for learning this in a week and configuring a server for the first time. =P

    Hope this helps someone out there down the road. =)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •