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 8771731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:51:49+00:00 2026-06-13T17:51:49+00:00

I am trying to get my jquery ajax working properly, but facing a ReferenceError

  • 0

I am trying to get my jquery ajax working properly, but facing a ReferenceError when developing with Firebug:

jQuery(document).ready(function() {
    jQuery('.my-div').click(function(e){
    e.preventDefault();
    var href = jQuery(this).attr('href');
    jQuery.ajax({
      type: "POST",
      url:href,
      dataType:html,
      success: function(data, status, xhr){ $('#div_to_load_html').html(data); },
      error: function(){ alert("Error"); },
    });
    });
})

html:

<div class='my-div'><a href='/place/to/go/'>GO!</a></div>

When I click ‘my-div’, Firebug returns: ReferenceError: html is not defined @ http://www.mydomain.com/:38, which references the line from my jquery dataType:html.

Thanks for your ideas!

  • 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-06-13T17:51:50+00:00Added an answer on June 13, 2026 at 5:51 pm

    You can just remove the option “dataType:html,” to let $.ajax deduce the datatype.

    But, to answer the question, the right syntax id dataType:'html' with quote because it is not a variable

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

Sidebar

Related Questions

I'm trying to get an jquery ajax callback function to update the background colour
I'm trying to get a tracking script working that uses AJAX via JQuery. This
I'm trying to learn jQuery's ajax functions. I've got it working, but jQuery doesn't
I'm trying to get validation errors with Ajax and jQuery working in CakePHP 2.1
I am trying to get jquery's .ajax() to send values sent to a form
I am trying to get a piece of data back using jQuery ajax via
I'm trying to get a jsonp callback working using jquery within a greasemonkey script.
I am very new to javascript and ajax/jquery and have been working on trying
I've been trying to get this really simple example of using AJAX with JQuery
I'm trying to generate some XML for a jQuery.get (AJAX) call, and I'm getting

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.