473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Javascript/ Ajax Error. I can't figure it out.

I have a JavaScript in an external page and the script reference in the master page of asp.net. I am getting an error I can not figure out.

"Now it is saying that JavaScript runtime error: Unable to set property 'onclick' of undefined or null reference."

Any tips on how to fix this would be greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function () {
  2.  
  3.     var myButton = document.getElementById('<%= btnsubmit.ClientID %>');
  4.  
  5.     myButton.onclick = function () {
  6.  
  7.         var script = document.createElement("script");
  8.         $.ajax({
  9.             url: "testmenow.aspx",
  10.             data: null,
  11.             success: function (data) {
  12.                 $("#parttable").html(data);
  13.             }
  14.         });
  15.         return false;
  16.     }
  17.  
  18.  
  19. });
  20.  
  21.  
  22. ASP page
  23. <div id="parttable"> </div> <asp:Button ID="btnsubmit" runat="server" Text="click me" name="btnsubmit" />
Apr 26 '14 #1
1 1690
Dormilich
8,658 Expert Mod 8TB
that simply means that JS failed to locate your myButton element.
Apr 28 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kentor | last post by:
hello, im trying to make a little loop, but i cant figure it out... i have a string with a bunch of 1s and 0s in it: 110101010101111010101 .... i need to count the number of 1s divide it by 2 and...
1
by: JohnnieTech | last post by:
I am using some javascript/ajax to load content into a main div. The problem I am running into is that it will work in IE but not in FF. In FF I don't get any sort of load at all. I have a 1...
1
by: satishr23 | last post by:
Hi, I am having some problems with handling cross domain requests in javascript/ajax and would really appreciate any help. My client has a javascript file which he includes in his HTML...
2
by: papillonhn | last post by:
hi everybody. I have a question: Doesn't Ajax for .net have xmlserializer class in javascript? It just have Sys.Serialization.JavaScriptSerializer library to use for Json. I need a...
5
by: chevon1920 | last post by:
I am trying to do my assignment but I cant figure out how to get 8 data points per line to print to a file. Here is the assignment 1. Program asks the user to enter an odd number as a BASE,...
61
anfetienne
by: anfetienne | last post by:
could anyone tell me the mthod to use javascript/ajax to post to a sql database? or could someone point me to a tutorial?
1
by: david adeniji | last post by:
Pls guyz, i'm a php developer. I need reference to any material dat would teach me major concepts in javascript/ajax in d shortest possible time to enhance the delivery speed of my applications.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.