I am working on a web app that can display data in two drastically different formats. To do this, I am using a master page with two different content pages for the differing views. I am using .svc files to do AJAX style server requests. I would like to be able to do a service call from the master pages javascript, then run the appropriate onSuccess javascript method (which would ideally lie in another .js file) to display the data based on which content page I am in. I am guessing this would be done with some kind of function delegate, but I am new to web development and not sure how to do this. Any help would be greatly appreciated.
Calling a content page's javascript from a master pages javascript
212 views Asked by unbootabru At
2
There are 2 answers
0
Plato
On
If you can do everything on one page, your HTML will probably look something like this:
<!DOCTYPE html>
<html>
<head>
<script src="masterScript.js"></script>
<script src="module/childScript.js"></script>
<script>
console.log(globalVariableFromMasterScript)
doSomethingFromChildScript(globalVariableFromMasterScript)
</script>
</head>
<body>
<p>This is the html page</p>
</body>
</html>
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in AJAX
- window.location.href redirects but is causing problems on the webpage
- Js variable to php using ajax
- TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation - Insert blob into database
- how do I change a URL with form to include additional selection
- why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
- Opening modal through Update button with specified ID using ajax
- Events disappear randomly for full calendar module
- Ajax call reloads page in FrontAccounting, a PHP ERP solution
- Add newly added record to select2 element
- AJAX query cascading dropdown in django
- Failed to load resource: the server responded with a status of 403 () - SCRIPT - WordPress
- Maintaining search and sort state across paginated results in web application
- Getting POST 500 Internal server error while sending request via ajax call
- Wordpress server side datatable filtering
- Having a problem in datatables and fullcalendar scripts
Related Questions in MASTER-PAGES
- How to call Method(Function) from one webpage to another webpage using Master page in ASP.NET C#
- webpart is not detecting language change
- Bootstrap Modal no longer showing - Jquery in Site Master
- Declare a global variable in a shared page in ASP.NET Core MVC
- Convert asp.net c# 2003 master+pages to fixed menu panel page and loading aspx pages like a partial page with server render (without calling master)
- .NET master page equivalent in Angular with external html pages
- Issues with dropdown list HTML
- Can the _Layout.cshtml (Master Page) render without views?
- Button Click Event Not Firing On Masterpage at Root Of Application
- URL path repeating on click from one link to another - asp.net
- Not found Page with master page in C#
- Master View with AppShell
- Hide element with JS from C# in Site.Master the elemet is appearing again after page refresh
- Change text of a Label in site.master from code-behind
- Referencing enum by shorthand from .Master file
Related Questions in SERVICECONTRACT
- Modules Communication in Modulare Monolith architecture
- What is the meaning of [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] in the official WCF tutorial?
- How to fix/diagnose "The remote server returned an error: (400) Bad Request." for a query working on site A but not on site B
- WCF pass integer array through object parameter
- How can I have an WCF service with multiple classes?
- WCF service only receiving 65536 String.Length size only, not more than that
- WCF service with protocol buffer, how the config file will look like
- Rest service returns “method not allowed” on webpage
- Use parameter "params string[]" in WCF Rest endpoint
- how to add a parameter to soap body in wcf
- Can I expose a data member in a WCF ServiceContract?
- Consume WCF service from client without WCF Service Library project/assembly reference
- Is changing a parameter in a OperationContract to it's Nullable<T> equivalent considered a breaking change?
- assembly: ContractNamespace() , this option is not available in AssemblyInfo.cs file?
- Calling a content page's javascript from a master pages javascript
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
This was a stupid question... Just attach different js files to the content pages. Give the functions the same name and it works fine.