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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:08:43+00:00 2026-05-26T05:08:43+00:00

Background : I have two dropdowns on my page and when they are changed,

  • 0

Background: I have two dropdowns on my page and when they are changed, I am using the JQote plugin by AEFXX to populate a table with some of the returned JSON data. In the JSON response, some of the User Stories have Tasks associated with them, but these tasks do not have much information with them, so I had to do an extra GET request for each of the Tasks to return this information. Some of the tasks which are returned do not have an Owner assigned, resulting in the field Task.Owner = null.

Here is the code that I’m using to get each of the tasks:

if(result.Tasks != ""){
 $.each(result.Tasks, function(i, tasks){
    console.log(tasks._ref);
    $.ajax({
        url: tasks._ref,
        dataType: 'jsonp',
        jsonp: 'jsonp',
        success: function(data, textStatus, jqXHR) {
            $.get("task.tpl", function(tmpl) {
                $("#reqs").jqoteapp(tmpl, data.Task);
                });
            }
    });
 })
}

The template (task.tpl) looks like this:

<tr id="infoReturned">
  <td name="id" class="row"><%= this.FormattedID %></td>
  <td name="name" class="row"><%= this._refObjectName %></td>
  <td name="state" class="row"><%= this.State %></td>
  <td name="owner" class="row"><%= this.Owner._refObjectName %></td>
</tr>

Trial:
I referred to How to test an empty Object from JSON.

I added the following function:

        function isEmpty(obj) {
            for (var prop in obj) {
                if (obj.hasOwnProperty(prop))
                    console.log("false");
                    return false;
            }
        }

, modified the success function of the GET to be this:

success: function(data, textStatus, jqXHR) {
 if (isEmpty(data.Task.Owner)){
    $.get("emptyTask.tpl", function(tmpl) {
    $("#reqs").jqoteapp(tmpl, data.Task);
    });                                         
 }
 else {
    $.get("task.tpl", function(tmpl) {
    $("#reqs").jqoteapp(tmpl, data.Task);
    });
 }

}

, and created a new template file (emptyTask.tpl) with the Owner section empty:

<tr id="infoReturned">
 <td name="id" class="row"><%= this.FormattedID %></td>
 <td name="name" class="row"><%= this._refObjectName %></td>
 <td name="state" class="row"><%= this.State %></td>
 <td name="owner" class="row"></td>
</tr>

, but I’m still getting the error:

Uncaught TypeError: <unknown message TemplateExecutionError>
(anonymous function)
$.extend.jqotejquery.jqote2.js:107
$.each.$.fn.(anonymous function)jquery.jqote2.js:76
$.ajax.success.$.each.$.each.$.ajax.successpy2Test.html:155
jQuery.extend._Deferred.deferred.resolveWithjquery-latest.js:1016
donejquery-latest.js:7247
jQuery.ajaxTransport.send.callbackjquery-latest.js:8028

Question:
How can I fix the last part of the task.tpl to account for possible null values, or modify the AJAX success function to correctly handle this case?

  • 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-26T05:08:43+00:00Added an answer on May 26, 2026 at 5:08 am

    Found a solution which is similar to what I was trying earlier:

    if ((data.Task.Owner) == null){
      $.get("emptyTask.tpl", function(tmpl) {
      $("#reqs").jqoteapp(tmpl, data.Task);
      });                                           
    }
    else {
      $.get("task.tpl", function(tmpl) {
      $("#reqs").jqoteapp(tmpl, data.Task);
      });
    }
    

    I’m still interested in a solution in which the template file is modified to handle this issue though.

    Please post if you have another answer!

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

Sidebar

Related Questions

I have two questions regarding to html table layout. First I will provide some
Some Background We have a team of four developers and we have two web
I want to have my page to have two background images: one at the
Brief background: I have two-step login page, which after step 1 sends one-time code
Background: We have two directories of Crystal Reports for both the web side of
Is it possible to have two background images? For instance, I'd like to have
I have two layers being drawn. A static background texture and a texture(png) with
If I have two css files: File 1: .colorme { background-color:Red; } File 2:
I need change background of all text that have two spaces from the start
Background This question is in two parts. I have a one-way WCF operation hosted

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.