Guest User

Untitled

a guest
Jan 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. $.ajax({
  2. type: "POST",
  3. url: baseUrl + "profile/setting",
  4. dataType: 'json',
  5. success: function(data){
  6. var html = "";
  7. html += "<div>";
  8. html += "<img src="" + baseUrl + data.picture + "" />";
  9. html += "<div>" + data.email + "</div>";
  10. html += "<div>" + data.first_name + " " + data.last_name + "</div>";
  11. html += "<div>" + data.address + "</div>";
  12. html += "<div><input type="text" class="input_text_top"/></div>";
  13. html += "<div><input type="text" class="input_text_middle"/></div>";
  14. html += "<div><input type="text" class="input_text_bottom"/></div>";
  15. html += "<div><input type="submit" class="btn btn_grey"/></div>";
  16. html += "</div>";
  17. $('#result_column').removeAttr('style').html(data);
  18. }
  19. });
  20.  
  21. $response = $this->load->view("your_ajax_view", $data, TRUE);
  22. //do anything you would need to with the response.
  23. echo $response;
  24.  
  25. $.ajax({
  26. type: "POST",
  27. url: baseUrl + "profile/setting",
  28. success: function(data){
  29. $('#result_column').html(data);
  30. }
  31. });
  32.  
  33. function setting()
  34. {
  35. //whatever your code is, but then just pass the json
  36. //data you were echoing before to the view file
  37. $data['json_stuff'] = '';//however you generat this
  38. $this->load->view('some view file', $data);
  39. return;
  40. }
Add Comment
Please, Sign In to add comment