dongshang6062 2016-06-02 21:01
浏览 32

返回不在ajax结果中工作

The return is not working in this code -

public function articleImage_1_Refresh(){
    $article_id = trim(Input::get('article_id'));
    $article_id = Crypt::decrypt($article_id);
    $singleData = DB::table('articles')
        ->where('id',$article_id)
        ->get();
    $image_1 = $singleData[0]->image_1;
    //return $image_1;
    return '<img id="article_image_1" class="img-responsive custom_margin_auto" src="{{URL::asset('images/articles/'.$image_1)}}" alt="Article Image 1"></img>';
}

Which will be used in -

success:function(result){ // you wrote here response
    alert (result);
    $('#article_image_1_container').html(result);
}

There is a syntax error in the return line, but can not figure out. Please help.

</div>
  • 写回答

1条回答 默认 最新

  • dongshou6041 2016-06-02 21:06
    关注

    success:function(result) is not correct JavaScript. Try var success = function(result).

    Next time, try looking at the console and figure out what exactly throws a syntax error. It's faster than pasting code here :).

    评论

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)