×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    1

    Appending user input to url

    hi all,do anyone know how to append user input to url using nokia rss reader example?

    below are my code,can anyone tell me if there any part tat i do wrongly..thanks!

    Code:
    ///////////////////////////////////////////////////////////////////////////////
    // The FeedUpdateBroker class implements a simple RSS fetcher and parser.
    
    // Constructor.
    function FeedUpdateBroker() {
        this.httpReq = null;
        this.callback = null;
    }
    
    // Fetches a feed from the specified URL and calls the callback when the feed
    // has been fetched and parsed, or if the process results in an error.
    FeedUpdateBroker.prototype.fetchFeed = function(feedURL,name,callback) {
        // remember callback
        this.callback = callback;
        
        // create new XML HTTP request
        this.httpReq = new XMLHttpRequest();
        
        // set callback
        var self = this;
        this.httpReq.onreadystatechange = function() { self.readyStateChanged(); };
    
        // append the current time after the URL to bypass caches
        var fullURL = feedURL;
    	var Name = name;
    	
    	alert(Name);
        if (fullURL.indexOf("?") == -1) {
            fullURL += "?";
        } else {
            fullURL += "&";
        }
        fullURL += "nocache=" + Name ;
    	
        // Enable Universal Browser Read
    	if (netscape.security.PrivilegeManager.enablePrivilege) 
    	netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
    
        // initiate the request
        this.httpReq.open("GET", fullURL,true);
    	
        this.httpReq.send(null);
    	
    	
    }
    
    // Callback for ready-state change events in the XML HTTP request.
    FeedUpdateBroker.prototype.readyStateChanged = function() {
        // complete request?
        if (this.httpReq.readyState == 4) {
            // attempt to get response status
            var responseStatus = null;
            try {
                responseStatus = this.httpReq.status;
            } catch (noStatusException) {}
            
            // handle the response and call the registered callback
            this.callback.call(this, this.handleResponse(responseStatus, this.httpReq.responseText));
        }
    }
    
    // Handles a completed response.
    FeedUpdateBroker.prototype.handleResponse = function(responseStatus, xmlDoc) {
         if (responseStatus == 200) {
    	 	
       		alert(xmlDoc);
    		
    	
         	var myArray2 = xmlDoc.split("|");
    
    		var item = [];
    		
            for (var i = 1; i < myArray2.length; i++) {
            
                var array3 = (myArray2[i].toString()).split("~/");
                
    			
    			
                item.push({
                    invitedby: array3[0],
                    date: array3[1],
                    time: array3[2],
    				event:array3[3],
                    location: array3[4],
    				message: array3[5],
    				participate: array3[6],
                });
            	
    	    }
    
            return {
    			status: "ok", item:item
    			
            };
        }
        else {
            // update failed
            return {
                status: "error"
            };
        }
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: Appending user input to url

    Hi camilia90,

    welcome to Forum Nokia Discussion Boards!

    it seems you're appending to the base feed URL a part with "nocache=" followed by the 'name' parameter passed to the fetchFeed() method: is it right? If so, which kind of error do you get when executing this code?

    Pit

Similar Threads

  1. WAP and URL problem
    By Paranoid_Android in forum General Messaging
    Replies: 0
    Last Post: 2008-05-28, 10:49
  2. How to input string from user?
    By RT22 in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-05-07, 06:43
  3. How to have user input string of only digits
    By yqmtooblue in forum Symbian
    Replies: 3
    Last Post: 2007-12-06, 14:33
  4. Using input from user keypad
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-05-15, 20:27
  5. SMS from change in N30 input pin
    By vhkauppi in forum Nokia M2M
    Replies: 2
    Last Post: 1970-01-01, 02:00

Posting Permissions

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