SpoozyGysfups
New Member
I have an error while invoking the goToXProfile(targetusername) it raised an exception "Microsoft JScript runtime error: 'test' is undefined" which 'test' is the passed targetusername parameter. here is my code \[code\]function getQuestionByID() { var QuestionID = localStorage["QuestionID"]; var postData = http://stackoverflow.com/questions/12782259/{'Function': 'GetQuestionByID', 'QuestionID': questionID, 'UserID': userID }; $.ajax({ beforeSend: function () { $.mobile.showPageLoadingMsg(); }, //Show spinner complete: function () { $.mobile.hidePageLoadingMsg() }, //Hide spinner type: "GET", url: serviceUrl + "/Questions.aspx", data: postData, contentType: "application/json; charset=utf-8", dataType: "jsonp", jsonp: 'jsoncallback', success: function (result) { viewQuestion(result); }, error: function (msg) { alert('Sorry, a problem happened'); } });}function viewQuestion(data) { var QuestionData = http://stackoverflow.com/questions/12782259/(typeof data) =='string' ? eval('(' + data + ')') : data; if (data !== undefined || data !== "0") { $('#QuestionChosen').empty(); var text = '<li data-role="list-divider" class="vote-list-divider">' + QuestionData.Pt_Title + '<span onclick="voteForQuestion(1);" id="voteUp" class="ui-li-count vote">+ ' + QuestionData.Likes + '</span><span onclick="voteForQuestion(-1);" id ="voteDown" class="ui-li-count vote">- ' + QuestionData.Dislikes + '</span></li><li><a rel="external" onclick = "editQuestionChecking();"><h3>' + QuestionData.Sub_Name + '</h3><p>' + QuestionData.Pt_Body + '</p><a onclick="goToXProfile(' + QuestionData.SU_Username + ');"> CreatedBy: ' + QuestionData.SU_Username + '</a></a><a id="bookmarked"onclick="bookmarkQuestion();" data-icon="star" data-theme = "b"></a></li> '; $('#QuestionChosen').append(text); $("#QuestionChosen").listview('refresh'); var QoriginalVoteValue = http://stackoverflow.com/questions/12782259/QuestionData.OriginalVoteValue; if (QoriginalVoteValue == 1) { $('#voteUp').addClass("up-vote-active"); } else if (QoriginalVoteValue =http://stackoverflow.com/questions/12782259/= -1) { $('#voteDown').addClass("down-vote-active"); } bookmarked = QuestionData.Bookmarked if (bookmarked) { $('#bookmarked').attr("data-theme", "a").removeClass("ui-btn-up-b").addClass("ui-btn-up-a"); } viewQuestionAnswers(localStorage["QuestionID"]); } else { alert("Sorry, this question can't be accessed, it's either deleted or you don't have permission to access it"); }} function goToXProfile(x) { getQuestionUser(); localStorage["XUserID"] = localStorage["AskerID"]; localStorage["XUsername"] = x; alert("XUserID = " + localStorage["XUserID"]); alert("XUsername = " + localStorage["XUsername"]);}\[/code\]Any suggestions? Thanks in advance.