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

  • Home
  • SEARCH
  • 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 7525765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:38:35+00:00 2026-05-30T03:38:35+00:00

if $list[$i][wo_status] has no value, I call whatson_read function, it do ajax for db

  • 0

if $list[$i][wo_status] has no value,
I call whatson_read function,
it do ajax for db operation.
after success url reokaced
screen location moves to location of element id specified.

but after few micro second, secreen moves to top location.
why this happens?

php section

      if ($list[$i][wo_status])
          echo "<a href='" . $list[$i][url]  . "' $target_link >";
      else
          echo "<a href='#' onclick='javascript:whatson_read(\"" . $list[$i][url] . "\", " . $list[$i][wo_id] . "); return false' >";

Javascript section

<script type="text/javascript">
function whatson_read(url, wo_id) {

    var post_url = "<?=$g4[bbs_path]?>/ajax_whatson.php?w=r&wo_id="+wo_id;
    var data = "";

    $.ajax({
        type:"POST",
        url:post_url,
        data:data,
        async:false,
        error:function() {
            alert('fail');
        },
        success: function(){
            <? if ($target) { ?>
        parent.<?=$target?>.location.href = url ;
            <? } else { ?>
        location.href = url;
        <? } ?>
        }
     });
}
</script>
  • 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-30T03:38:37+00:00Added an answer on May 30, 2026 at 3:38 am

    Please don’t use <a href="javascript:">. That’s an old, outdated practice.

    Currently, your link is pointing to the in-page anchor #. That anchor doesn’t exist on the page, so when you click the link, the browser just takes you to the top of the page.

    You need to return false from your onclick handler to prevent the default action of the click event. This is conventional in JavaScript:

    <a href="#" onclick="whatson_read(...); return false;">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

List<Foo> fooList = Session[foo] as List<Foo>; fooList.Add(bar); Does the call to Add() change the
List Comprehension for me seems to be like the opaque block of granite that
List Comprehension is a very useful code mechanism that is found in several languages,
List<String> nameList = new List<String>(); DropDownList ddl = new DropDownList(); List is populated here,
List<tinyClass> ids = new List<tinyClass(); ids.Add(new tinyClass(1, 2)); bool b = ids.IndexOf(new tinyClass(1, 2))
List comprehensions can be useful in certain situations, but they can also be rather
List<SelectListItem> items = new List<SelectListItem>(); if (a) { SelectListItem deliveryItem = new SelectListItem() {
List<CertMail> lsRecipetNumber = new List<CertMail>(); CertMail class is in data access layer which returns
List<MyClass> myclassList = (List<MyClass>) rs.get(); TreeSet<MyClass> myclassSet = new TreeSet<MyClass>(myclassList); I don't understand why
list<int> foo; list<int> foo2; list<int>::iterator foo_end = foo.end(); list<int>::iterator foo2_end = foo2.end(); for (list<int>::iterator

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.