jquery remove double brackets

Posted on 2014-07-15
Last Modified: 2014-07-15

yes how do i remove double brackets if rendered. if there is one bracket check if two then remove.
Question by:sevensnake77
    LVL 35

    Accepted Solution

    try this:
    var obj = $.parseJSON(response.replace(/^\[(\[.*\])\]$/,"$1"));

    Open in new window
    LVL 21

    Expert Comment

    by:Randy Poole
    function fnSuccess(response) {
    	var toAppend = "";
    var obj = $.parseJSON(response); 
    //	var obj = jQuery.parseJSON(response);
    	$.each(obj, function(i, item) {
          		toAppend += '<div style=""><label>Comments #11 : </label><textarea id=' + item.BID + '  name='+  item.BID + '"  cols="40" rows="6">' + item.myComment + '</textarea></div>'; 

    Open in new window

    LVL 9

    Author Closing Comment

    thanks Robert Schutt: much cleaner. and I love expressions.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
    Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now