2026, 새로운 도약을 시작합니다.

게시판 검색 결과 ajax로 더보기 채택완료

게시판 검색을 하면

bo_table=게시판&sca=카테고리 ... 이런식으로 있는데

이 값들을 get으로 ajax에 보냈는데 작동을 안하네요 ...


보내는건 아래와 같이 보냈습니다.

Copy
var _tempUrl = decodeURIComponent(window.location.search.substring(1)); //url에서 처음부터 '?'까지 삭제        var _tempArray = _tempUrl.split('&'); // '&'을 기준으로 분리하기        var _sca = _tempArray[1].split('=');   //sca자르기        var _sop = _tempArray[2].split('=');    //sop자르기        var _sfl = _tempArray[3].split('=');    //sfl자르기        var _stx = _tempArray[4].split('=');    //stx자르기     if(document.getElementById('scr_content'+btn) == null){        $.ajax({            url : "경로",            type : "get",            dataType : "json",            data :{                no: btn,                board : _board[1],                sca : _sca[1],                sop : _sop[1],                sfl : _sfl[1],                stx : _stx[1]            },


ajax.more_read.php에는

Copy
include_once('../../../../common.php');$link = mysqli_connect("", "", "", "");
$board = $_GET['board'];$sca = $_GET['sca'];$sop = $_GET['sop'];$sfl = $_GET['sfl'];$stx = $_GET['stx'];
$total_sql = "select count(*) as total from {$g5['write_locationboard_table']} where wr_is_comment = 0";
$total_row = mysqli_query($link, $total_sql);$total_result = mysqli_fetch_array($total_row);
$first_rows = $_GET['no'];	//시작점
if($_GET['no'] == null){	$first_rows = 0;}$end_rows = $first_rows + 10;	//마지막점
$rows = $total_result[0];	//전체 글 수


// $get_sort = $_GET['sort'];// if($get_sort == "good"){// 	$sort = wr_good;// }else if($get_sort == null || $get_sort == "new"){// 	$sort = wr_datetime;// }else if($get_sort == "hit"){   //조회 순// 	$sort = wr_hit;// }else if($get_sort == "cmt"){   //댓글 순// 	$sort = wr_comment;// }else{// 	$sort = wr_datetime;// }
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
if($sca || $stx){	$sql = "select distinct wr_parent from {$g5['write_locationboard_table']} where {$sql_search} and wr_is_comment = 0  limit {$first_rows}, {$end_rows}"; //order by {$sort}	$result = sql_query($sql);
	for($k=$first_rows; $k


위와 같이 검색에 필요하다 싶은것만 가져왔는데 


어디가 잘못된 걸까요..


에러는 

Uncaught TypeError: Cannot read property 'split' of undefined

var _sop = _tempArray[2].split('=');    //sop자르기


여기 부분을 찍어주는데....


답변 1개

채택된 답변
+20 포인트

var_tempArray = _tempUrl.split('\\&'); // '&'을 기준으로 분리하기 



로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고