Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6668853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:05:09+00:00 2026-05-26T03:05:09+00:00

My Ajax call is almost working, but i can’t figure why my layout is

  • 0

My Ajax call is almost working, but i can’t figure why my layout is still rendered? here is the context:

I have a contact page on my site that use the linkedIn API. I want to load the LinkedIn info from an ajax call when my page is loaded. This work fine.

But the result of my .load() is rendered with the layout of my site. I only want to render the html in my ajax_contact.html.erb..

contact.js

 $(document).ready(function() {

   $(".info_perso").load( '/contact/ajax_contact', {name:"benoit"}, function(data){  $(".info_perso").html( data );})

 });

ajax_contact.html.erb:

<%if !@profile.nil?%>

                <%=image_tag(@profile.picture_url)%><br />
                <%=@profile.first_name %> <%=@profile.last_name %><br>
                <%=@profile.headline%><br> 
                <%=@profile.industry%><br> <br />
                <%=@profile.summary%><br> 


                <label class="linkedin_title">Education</label><br>
                <% @profile.educations.all.each {|edu| %>

                    Degre : <%=edu.degree%><br>         
                    Années : <%=edu.start_date.year%> - <%=edu.end_date.year%><br>                      
                    Concentration : <%=edu.field_of_study%><br>         
                    Universite : <%=edu.school_name%><br>           
                <%}%>
                <label class="linkedin_title">Experience</label><br>
                <% @profile.positions.all.each {|pos| %>
                    <label class="linkedin_subtitle"> Company:</label> <%=pos.company.name%><br><br>                            
                    <label class="linkedin_subtitle">Titre :</label> <%=pos.title%><br>         
                    <label class="linkedin_subtitle">Années :</label> <%=pos.start_date.month%>/<%=pos.start_date.year%> - <%=  pos.end_date? ? pos.end_date.month.to_s + "/" + pos.end_date.year.to_s : "now"%><br>                        
                    <label class="linkedin_subtitle">Description :</label> <%=pos.summary%><br/><br/>           
                <%}%>

            <%else%>
                <%=link_to "Activer linkedIn", :controller=>"linkedinAuth", :action=>"benoit", :name=>"benoit", :callback=>"/linkedinauth/callbackbenoit"%>
            <%end%>             

contact_controller.rb:

  def ajax_contact
name = params[:name]
linkedinInfo = LinkedinApiInfo.find(1)
linkedinCred = LinkedinCredential.find_by_name(name)
if !linkedinCred.nil?
  client = LinkedIn::Client.new(linkedinInfo.apiKey, linkedinInfo.secretKey)
  client.authorize_from_access(linkedinCred.acctoken, linkedinCred.accsecret)
  # Pick some fields
  fields = ['first-name', 'last-name', 'headline', 'industry', 'num-connections','educations', 'num-recommenders','recommendations-received', 'summary', 'positions','picture-url']

  @profile = client.profile :fields => fields
  @profile.recommendations_received.all.each {|rec| puts rec.recommendation_text}


  puts @profile

end
 rescue SocketError
  puts "Unable to connect"

  render "ajax_content", :content_type=>"text/html", :layout=>false

   end

Even with the :layout=>false, my layout is still showned!!! anyone can see the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:05:09+00:00Added an answer on May 26, 2026 at 3:05 am

    add

    render ‘ajax_contact’, :layout=>false

    to your action, at the end, also partial views name should start with _, so your view should be named ‘_ajax_contact’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this ajax call executing from client side, with jQuery, but at times,
Here's my ajax call: $.ajax({ url: 'url-to-json', type: 'POST', dataType: 'json', cache: 'false', data:
Within my ajax call if an error is received I have an alert :
I have a jQuery ajax call that returns html of a table. Now I
I have a jQuery AJAX call that I will need to do multiple times
I have an ajax call in my code. What I want to achieve with
I have the following ajax call var prev_sibling = $(this).prev().attr(value); var next_sibling = $(this).next().attr(value);
If I have an ajax call off fetching (with a callback) and then some
I have an AJAX call in my jQuery/PHP app. It needs to send some
I have a jquery Ajax call function that I use to submit form to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.