I am trying to get the view-source of a website and then doing a regex match. I am using jQuery. I was testing the script in Google developer console. It is returning this error Cannot read property 'match' of undefined . . But it is working expected when I am entering individual command one by one. 
q = "google.com";
var view_src = $.get('http://'+q, function(response) 
                                         { return response; 
                                         }
                           );
       var src_res = view_src.responseText;
       var reg_gg = src_res.match(/google.com/);
       console.log(reg_gg);
 
    