@@ -495,30 +495,33 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
495495 this . resetPage ( ) ;
496496 }
497497 lastVal = val ;
498- lastVal && $ . get (
499- 'https://searchcode.com/api/codesearch_I/' + ( langQuery ?( '?' + langQuery ) :'' ) ,
500- {
498+ lastVal && $ . ajax ( {
499+ type : 'GET' ,
500+ dataType : 'json' ,
501+ url : 'https://searchcode.com/api/codesearch_I/' + ( langQuery ?( '?' + langQuery ) :'' ) ,
502+ data : {
501503 q : lastVal ,
502504 p : page ,
503505 per_page : 100
504506 } ,
505- function ( data ) {
507+ success : function ( data ) {
506508 callback && callback ( data , page ) ;
507509 page ++ ;
508510 }
509- )
511+ } )
510512 } ;
511513
512514 //get source code by id
513515 this . requestSourceCode = function ( id , callback ) {
514516 lastCodeId = id ;
515- lastCodeId && $ . get (
516- 'https://searchcode.com/api/result/' + lastCodeId + '/' ,
517- { } ,
518- function ( data ) {
517+ lastCodeId && $ . ajax ( {
518+ type : 'GET' ,
519+ dataType : 'json' ,
520+ url : 'https://searchcode.com/api/result/' + lastCodeId + '/' ,
521+ success : function ( data ) {
519522 callback && callback ( data ) ;
520523 }
521- )
524+ } ) ;
522525 }
523526 } ;
524527
@@ -642,6 +645,7 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
642645
643646 function showSourceCode ( ) {
644647 searchcode . requestSourceCode ( this . dataset . id , renderSourceCode ) ;
648+ els . sourceCodeModal . modal ( 'toggle' ) ;
645649 }
646650
647651 function onLocationHashChanged ( e ) {
@@ -847,7 +851,6 @@ <h5 class="variable-wrap" data-id="{id}" data-repo="{repo}" data-url="{url}" dat
847851
848852 function renderSourceCode ( data ) {
849853 data && els . sourceCodeContent . text ( data . code ) ;
850- els . sourceCodeModal . modal ( 'toggle' ) ;
851854 }
852855 function removeVariableMenus ( ) {
853856 els . body . find ( '.popover--variable' ) . remove ( ) ;
0 commit comments