Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. //cloudapp.azure.com/js/script2.js
  2.  
  3. if(error_username == false && error_password == false){
  4.  
  5. var details = [$("#username1").val(),$("#password1").val()];
  6.  
  7.  
  8. var url = "http://depressionapp1.westeurope.cloudapp.azure.com/index.php/";
  9.  
  10. $.ajax({
  11. url: url,
  12. type: 'POST',
  13. data: {dataname: details},
  14. success: function(result){
  15.  
  16. //THIS IS WHERE I AM HAVING PROBLEMS
  17.  
  18. location.href = "http://depressionapp1.westeurope.cloudapp.azure.com/welcome1.html";
  19.  
  20. /* or
  21. var url1 = "http://depressionapp1.westeurope.cloudapp.azure.com/" + result;
  22. $.get(url1);*/
  23.  
  24.  
  25. }
  26.  
  27.  
  28.  
  29.  
  30. });
  31.  
  32. //UserController@postLogin works fine and returns 'welcome.html'
  33.  
  34. public function postLogin(Request $request){
  35. $result = DB::table('users')->select('user_id')->where('username', $request['username'])->get();
  36. $user = $result[0];
  37. $val = '';
  38. if(Auth::attempt(['username' => $request['username'], 'password' => $request['password']])){
  39.  
  40. $count = Answer::where('user_id', $user->user_id)->where('level', '<>', NULL)->count();
  41. if($count){
  42. return redirect()->route('checkLevel');
  43. }else{
  44. $val = 'welcome1.html';
  45. }
  46. }
  47. $data = array('page' => $val, 'id' => $user->user_id);
  48. return response($val);
  49.  
  50. I have shown the two attempts
  51.  
  52. $.ajax({
  53. url: url,
  54. type: 'POST',
  55. data: {dataname: details},
  56. success: function(result){
  57.  
  58. //THIS IS WHERE I AM HAVING PROBLEMS
  59.  
  60. location.href = "http://depressionapp1.westeurope.cloudapp.azure.com/welcome1.html";
  61.  
  62. /* or
  63. var url1 = "http://depressionapp1.westeurope.cloudapp.azure.com/" + result;
  64. $.get(url1);*/
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement